summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
AgeCommit message (Collapse)Author
2005-01-28When dealing with multiple grouping columns coming from the same table,Tom Lane
clamp the estimated number of groups to table row count over 10, instead of table row count; this reflects a heuristic that people probably won't group over a near-unique set of columns, and the knowledge that we don't currently have any way to estimate the correlation of the columns better than guessing. This change creates a trivial plan change in one of the regression tests.
2005-01-13get_names_for_var didn't do recursion for unnamed JOIN vars quite right;Tom Lane
got it wrong when the JOIN was in an outer query level. Per example from Laurie Burrow. Also fix same issue in markTargetListOrigin. I think the latter is only a latent bug since we currently don't apply markTargetListOrigin except at the outer level ... but should do it right anyway.
2005-01-13Remove unportable assumption that it's okay to use the target bufferTom Lane
of an sprintf() as a source string. Demonstrably does not work with recent gcc and/or glibc on some platforms.
2005-01-11interval_out failed to mention 'ago' for negative intervals in SQL andTom Lane
GERMAN datestyles. Ancient bug reported by Terry Lee Tucker.
2005-01-09Undo an unadvertised change in the API of pg_atoi. In all previousTom Lane
releases, a nonzero 'c' argument meant that the input string could be terminated by either that character or \0. Recent refactoring broke that, causing the thing to scan for 'c' only. This went undetected because no part of the main code actually passes nonzero 'c'. However it broke tsearch2 and possibly other user-written code that assumed the old definition. Per report from Tom Hebbron.
2005-01-01Some more missed copyright notices. Many of these look like theyTom Lane
should have been caught by the src/tools/copyright script ... why weren't they?
2005-01-01Update copyrights that were missed.Bruce Momjian
2004-12-31Tag appropriate files for rc3PostgreSQL Daemon
Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
2004-12-20Add support for Latin9 encoding in to_ascii(). Jaime CasanovaTom Lane
2004-12-17Make array_cat more paranoid about checking datatypes in empty arrays.Tom Lane
2004-12-17array_map failed to insert correct result type in an empty array.Tom Lane
Per example from Florian Pflug.
2004-12-13Avoid generating excess (and illegal) parentheses around an aliased JOINTom Lane
in prettyprint mode. Andreas Pflug
2004-12-11Instead of supposing (wrongly, in the general case) that the rowtypeTom Lane
of an inheritance child table is binary-compatible with the rowtype of its parent, invent an expression node type that does the conversion correctly. Fixes the new bug exhibited by Kris Shannon as well as a lot of old bugs that would only show up when using multiple inheritance or after altering the parent table.
2004-12-02Teach regex_fixed_prefix() the correct handling of advanced regexTom Lane
escapes --- they aren't simply quoted characters. Problem noted by Antti Salmela. Also fix problem with incorrect handling of multibyte characters when followed by a quantifier.
2004-12-01Fix timestamptz_age() to do calculation in local timezone not GMT, per bug 1332.Tom Lane
2004-11-24Our interface code for Spencer's regexp package was checking for regexpTom Lane
error conditions during regexp compile, but not during regexp execution; any sort of "can't happen" errors would be treated as no-match instead of being reported as they should be. Noticed while trying to duplicate a reported Tcl bug.
2004-11-20Patch of 2004-03-30 corrected date_part(timestamp) for extractingTom Lane
the year from a BC date, but failed to make the same fix in date_part(timestamptz).
2004-11-20Fix unportable isdigit() call --- must cast arg to unsigned char.Tom Lane
2004-11-09Use a hopefully-more-reliable method of detecting default selectivityTom Lane
estimates when combining the estimates for a range query. As pointed out by Miquel van Smoorenburg, the existing check for an impossible combined result would quite possibly fail to detect one default and one non-default input. It seems better to use the default range query estimate in such cases. To do so, add a check for an estimate of exactly DEFAULT_INEQ_SEL. This is a bit ugly because it introduces additional coupling between clauselist_selectivity and scalarltsel/scalargtsel, but it's not like there wasn't plenty already...
2004-11-05Create 'default_tablespace' GUC variable that supplies a TABLESPACETom Lane
clause implicitly whenever one is not given explicitly. Remove concept of a schema having an associated tablespace, and simplify the rules for selecting a default tablespace for a table or index. It's now just (a) explicit TABLESPACE clause; (b) default_tablespace if that's not an empty string; (c) database's default. This will allow pg_dump to use SET commands instead of tablespace clauses to determine object locations (but I didn't actually make it do so). All per recent discussions.
2004-11-01timestamptz_trunc() should only recalculate the timezone when truncatingTom Lane
to DAY precision or coarser; leave the timezone alone when precision is HOUR or less. This avoids surprises for inputs near a DST transition time, as per example from Matthew Gabeler-Lee. (The only reason we recalculate at all is so that outputs that are supposed to represent days will come out as local midnight, and that's not relevant for sub-day precision.)
2004-11-01Invent pg_next_dst_boundary() and rewrite DetermineLocalTimeZone() toTom Lane
use it, as per my proposal of yesterday. This gives us a means of determining the zone offset to impute to an unlabeled timestamp that is both efficient and reliable, unlike all our previous tries involving mktime() and localtime(). The behavior for invalid or ambiguous times at a DST transition is fixed to be really and truly "assume standard time", fixing a bug that has come and gone repeatedly but was back again in 7.4. (There is some ongoing discussion about whether we should raise an error instead, but for the moment I'll make it do what it was previously intended to do.)
2004-11-01Update comment to point to proper file.Bruce Momjian
2004-10-30I found a corner case in which it is possible for RI_FKey_check's callTom Lane
of HeapTupleSatisfiesItself() to trigger a hint-bit update on the tuple: if the row was updated or deleted by a subtransaction of my own transaction that was later rolled back. This cannot occur in pre-8.0 of course, so the hint-bit patch applied a couple weeks ago is OK for existing releases. But for 8.0 it seems we had better fix things so that RI_FKey_check can pass the correct buffer number to HeapTupleSatisfiesItself. Accordingly, add fields to the TriggerData struct to carry the buffer ID(s) for the old and new tuple(s). There are other possible solutions but this one seems cleanest; it will allow other AFTER-trigger functions to safely do tqual.c calls if they want to. Put new fields at end of struct so that there is no API breakage.
2004-10-28Fix to_number for the case of a trailing S.Tom Lane
Karel Zak
2004-10-27When displaying a Var that is a reference to a column of an unnamed join,Tom Lane
try to display it as a reference to the underlying column instead. This is a legitimate substitution (it wouldn't be for a named join) and it fixes some cases where the display would otherwise be ambiguous. Per example from Sim Zacks.
2004-10-19Add a HINT about the likely reason for 'invalid multibyte character for ↵Tom Lane
locale' failure.
2004-10-17pg_get_indexdef() didn't do quite the right thing with identifyingTom Lane
an index's tablespace.
2004-10-17Make locale_messages_assign() really work on Windows; the prior hackTom Lane
only covered the case of assigning "", and failed to recognize that actually setlocale(LC_MESSAGES,...) does not work at all on this platform. Magnus Hagander, some code prettification by Tom Lane.
2004-10-15Repair possible failure to update hint bits back to disk, perTom Lane
http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php. This fix is intended to be permanent: it moves the responsibility for calling SetBufferCommitInfoNeedsSave() into the tqual.c routines, eliminating the requirement for callers to test whether t_infomask changed. Also, tighten validity checking on buffer IDs in bufmgr.c --- several routines were paranoid about out-of-range shared buffer numbers but not about out-of-range local ones, which seems a tad pointless.
2004-10-13More minor cosmetic improvements:Neil Conway
- remove another senseless "extern" keyword that was applied to a function definition - change a foo more function signatures from "some_type foo()" to "some_type foo(void)" - rewrite another K&R style function definition - make the type of the "action" function pointer in the KeyWord struct in src/backend/utils/adt/formatting.c more precise
2004-10-12Message style revisionsPeter Eisentraut
2004-10-08Do proper testing of CIDR bits against network mask, e.g. don't allow:Bruce Momjian
test=# select '204.248.199.1/31'::cidr; Previous releases erroneously accepted such addresses. WARN IN RELEASE NOTES Kevin Brintnall
2004-10-07Change get_rule_expr so that when the input is a List, it displays theTom Lane
list elements comma-separated instead of barfing. This allows elimination of half a dozen redundant copies of that behavior, and also makes the world safe again for pg_get_expr() applied to pg_index.indexprs, per gripe from Alexander Zhiltsov.
2004-10-07Adjust comments previously moved to column 1 by pgident.Bruce Momjian
2004-10-04Remove arithmetic operators on the 1-byte-char datatype, as per proposalsTom Lane
made several times in the past. Add coercion functions between "char" and integer so that a workaround is possible if needed. Initdb forced.
2004-10-04Detect overflow in integer arithmetic operators (integer, smallint, andTom Lane
bigint variants). Clean up some inconsistencies in error message wording. Fix scanint8 to allow trailing whitespace in INT64_MIN case. Update int8-exp-three-digits.out, which seems to have been ignored by the last couple of people to modify the int8 regression test, and remove int8-exp-three-digits-win32.out which is thereby exposed as redundant.
2004-10-01Convert pg_stat_get_backend_idset to use the existing SRF support.Tom Lane
This seems the cleanest way of fixing its lack of a shutdown callback, which was preventing it from working correctly in a query that didn't run it to completion. Per bug report from Szima GÄbor.
2004-09-27Rewrite ReadArrayStr() to avoid O(N^2) behavior on large strings,Tom Lane
and hopefully improve code clarity while at it. One intentional semantics change: a backslashed space will not be treated as removable trailing whitespace, as the prior coding would do. ISTM that if it wouldn't be considered removable leading whitespace, it shouldn't be stripped at the end either.
2004-09-18Fix estimate_num_groups to be able to use expression-index statisticsTom Lane
when there is an expressional index matching a GROUP BY item.
2004-09-16Restructure subtransaction handling to reduce resource consumption,Tom Lane
as per recent discussions. Invent SubTransactionIds that are managed like CommandIds (ie, counter is reset at start of each top transaction), and use these instead of TransactionIds to keep track of subtransaction status in those modules that need it. This means that a subtransaction does not need an XID unless it actually inserts/modifies rows in the database. Accordingly, don't assign it an XID nor take a lock on the XID until it tries to do that. This saves a lot of overhead for subtransactions that are only used for error recovery (eg plpgsql exceptions). Also, arrange to release a subtransaction's XID lock as soon as the subtransaction exits, in both the commit and abort cases. This avoids holding many unique locks after a long series of subtransactions. The price is some additional overhead in XactLockTableWait, but that seems acceptable. Finally, restructure the state machine in xact.c to have a more orthogonal set of states for subtransactions.
2004-09-16Fix a read of uninitialized memory in array_out(). Perform some minorNeil Conway
cosmetic code cleanup at the same time.
2004-09-13Redesign query-snapshot timing so that volatile functions in READ COMMITTEDTom Lane
mode see a fresh snapshot for each command in the function, rather than using the latest interactive command's snapshot. Also, suppress fresh snapshots as well as CommandCounterIncrement inside STABLE and IMMUTABLE functions, instead using the snapshot taken for the most closely nested regular query. (This behavior is only sane for read-only functions, so the patch also enforces that such functions contain only SELECT commands.) As per my proposal of 6-Sep-2004; I note that I floated essentially the same proposal on 19-Jun-2002, but that discussion tailed off without any action. Since 8.0 seems like the right place to be taking possibly nontrivial backwards compatibility hits, let's get it done now.
2004-09-10Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane
rather than when returning to the idle loop. This makes no particular difference for interactively-issued queries, but it makes a big difference for queries issued within functions: trigger execution now occurs before the calling function is allowed to proceed. This responds to numerous complaints about nonintuitive behavior of foreign key checking, such as http://archives.postgresql.org/pgsql-bugs/2004-09/msg00020.php, and appears to be required by the SQL99 spec. Also take the opportunity to simplify the data structures used for the pending-trigger list, rename them for more clarity, and squeeze out a bit of space.
2004-09-02Yet another place where someone was being careless about the argumentsTom Lane
of <ctype.h> macros.
2004-09-02Cope with recent HPUX versions providing isfinite() instead of finite().Tom Lane
2004-09-01Tweak prettyprinting rules for saner indenting of UNION, INTERSECT,Tom Lane
EXCEPT constructs.
2004-08-30Another pgindent run with lib typedefs added.Bruce Momjian
2004-08-29Pgindent run for 8.0.Bruce Momjian
2004-08-29Update copyright to 2004.Bruce Momjian