summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
AgeCommit message (Collapse)Author
2004-02-12Added hints about the reason, why the command string inJan Wieck
the view pg_stat_activity is missing, as per Bruces suggestion. Jan
2004-02-04Use memmove() rather than memcpy() in set_var_from_var(). If this functionNeil Conway
is asked to assign a variable to itself, it will result in doing a memcpy() on an entirely-overlapping memory range, which results in undefined behavior according to ANSI C. That said, it is unlikely to actually do anything bad on any sane libc, but this keeps valgrind quiet.
2004-02-03pwdTom Lane
2004-02-03Rename SortMem and VacuumMem to work_mem and maintenance_work_mem.Tom Lane
Make btree index creation and initial validation of foreign-key constraints use maintenance_work_mem rather than work_mem as their memory limit. Add some code to guc.c to allow these variables to be referenced by their old names in SHOW and SET commands, for backwards compatibility.
2004-02-03Add function (actually an int4 and an int8 version) that generatesJoe Conway
a series of numbers, optionally using an explicit step size other than the default value (one). Use function in the information_schema to replace hard-wired knowledge of INDEX_MAX_KEYS. initdb forced due to pg_proc change. Documentation update still needed -- will be committed separately.
2004-02-02Avoid generating invalid character encoding sequences in make_greater_string.Tom Lane
Not sure how this mistake evaded detection for so long.
2004-02-01Make length() disregard trailing spaces in char(n) values, per discussionTom Lane
some time ago and recent patch from Gavin Sherry. Update documentation to point out that trailing spaces are insignificant in char(n).
2004-01-31Micro-opt: replace calls likeNeil Conway
appendStringInfo(buf, "%s", str); with appendStringInfoString(buf, str); as the latter form is slightly faster.
2004-01-31Fix text_position to not scan past end of source string in multibyteTom Lane
case, per report from Korea PostgreSQL Users' Group. Also do some cosmetic cleanup in nearby code.
2004-01-19Repair problem identified by Olivier Prenant: ALTER DATABASE SET search_pathTom Lane
should not be too eager to reject paths involving unknown schemas, since it can't really tell whether the schemas exist in the target database. (Also, when reading pg_dumpall output, it could be that the schemas don't exist yet, but eventually will.) ALTER USER SET has a similar issue. So, reduce the normal ERROR to a NOTICE when checking search_path values for these commands. Supporting this requires changing the API for GUC assign_hook functions, which causes the patch to touch a lot of places, but the changes are conceptually trivial.
2004-01-17Repair misestimation of indexscan CPU costs. When an indexqual containsTom Lane
a run-time key (that is, a nonconstant expression compared to the index variable), the key is evaluated just once per scan, but we were charging costs as though it were evaluated once per visited index entry.
2004-01-07More janitorial work: remove the explicit casting of NULL literals to aNeil Conway
pointer type when it is not necessary to do so. For future reference, casting NULL to a pointer type is only necessary when (a) invoking a function AND either (b) the function has no prototype OR (c) the function is a varargs function.
2004-01-06Apply the core parts of Dennis Bjorklund's patch to allow functionTom Lane
parameters to be declared with names. pg_proc has a column to store names, and CREATE FUNCTION can insert data into it, but that's all as yet. I need to do more work on the pg_dump and plpgsql portions of the patch before committing those, but I thought I'd get the bulky changes in before the tree drifts under me. initdb forced due to pg_proc change.
2004-01-05Adjust indexscan planning logic to keep RestrictInfo nodes associatedTom Lane
with index qual clauses in the Path representation. This saves a little work during createplan and (probably more importantly) allows reuse of cached selectivity estimates during indexscan planning. Also fix latent bug: wrong plan would have been generated for a 'special operator' used in a nestloop-inner-indexscan join qual, because the special operator would not have gotten into the list of quals to recheck. This bug is only latent because at present the special-operator code could never trigger on a join qual, but sooner or later someone will want to do it.
2003-12-29Using canonicalize_qual() to get rid of duplicate index predicateTom Lane
conditions is overkill; set_union() does the job about as well, and much more efficiently. Furthermore this avoids assuming that canonicalize_qual() will check for duplicate clauses at all, which it may not always do.
2003-12-28Clean up the usage of canonicalize_qual(): in particular, be consistentTom Lane
about whether it is applied before or after eval_const_expressions(). I believe there were some corner cases where the system would fail to recognize that a partial index is applicable because of the previous inconsistency. Store normal rather than 'implicit AND' representations of constraints and index predicates in the catalogs. initdb forced due to representation change of constraints/predicates.
2003-12-25> > I have no idea if this in Oracle or not. But it's something IBruce Momjian
> > needed, and other people in the past asked about it too. > > It is in Oracle, but you aren't exactly on the spot. It should be > > IYYY - 4 digits ('2003') > IYY - 3 digits ('003') > IY - 2 digits ('03') > I - 1 digit ('3') Here is an updated patch that does that. Kurt Roeckx
2003-12-21Back out:Bruce Momjian
> Attached is a patch that addressed all the discussed issues > that did not break backward compatability, including the > ability to output ISO-8601 compliant intervals by setting > datestyle to iso8601basic.
2003-12-20In my mind there were two categories of open issuesBruce Momjian
a) ones that are 100% backward (such as the comment about outputting this format) and b) ones that aren't (such as deprecating the current postgresql shorthand of '1Y1M'::interval = 1 year 1 minute in favor of the ISO-8601 'P1Y1M'::interval = 1 year 1 month. Attached is a patch that addressed all the discussed issues that did not break backward compatability, including the ability to output ISO-8601 compliant intervals by setting datestyle to iso8601basic. Interval values can now be written as ISO 8601 time intervals, using the "Format with time-unit designators". This format always starts with the character 'P', followed by a string of values followed by single character time-unit designators. A 'T' separates the date and time parts of the interval. Ron Mayer
2003-12-19Make to_hex() behave portably on negative input values (treat them asTom Lane
unsigned integers). Per report from Jim Crate.
2003-12-17Fix DecodeInterval to handle '-0.1' sanely, per gripe from Tilo Schwarz.Tom Lane
2003-12-07Repair indexed bytea like operations, and related selectivityJoe Conway
functionality. Per bug report by Alvar Freude: http://archives.postgresql.org/pgsql-bugs/2003-12/msg00022.php
2003-12-02Code and docs review for numeric-factorial patch.Tom Lane
2003-12-01Attached is a patch implementing factorial(), returning numeric. PointsBruce Momjian
to note: 1) arttype is numeric. I thought this was the best way of allowing arbitarily large factorials, even though factorial(2^63) is a large number. Happy to change to integers if this is overkill. 2) since we're accepting numeric arguments, the patch tests for floats. If a numeric is passed with non-zero decimal portion, an error is raised since (from memory) they are undefined. Gavin Sherry
2003-12-01netmask() and hostmask() functions should return maximum-length masklen,Tom Lane
per gripe from Joe Sunday.
2003-11-30Make PQescapeBytea and byteaout consistent with each other, andJoe Conway
octal escape all octets outside the range 0x20 to 0x7e. This fixes the problem pointed out by Sergey Yatskevich here: http://archives.postgresql.org/pgsql-bugs/2003-11/msg00140.php
2003-11-29$Header: -> $PostgreSQL Changes ...PostgreSQL Daemon
2003-11-16Fix datetime input parsing to accept YYYY-MONTHNAME-DD and related syntaxes,Tom Lane
which had been unintentionally broken by recent changes to tighten up the DateStyle rules for all-numeric date input. Add documentation and regression tests for this, too.
2003-11-12Cross-data-type comparisons are now indexable by btrees, pursuant to myTom Lane
pghackers proposal of 8-Nov. All the existing cross-type comparison operators (int2/int4/int8 and float4/float8) have appropriate support. The original proposal of storing the right-hand-side datatype as part of the primary key for pg_amop and pg_amproc got modified a bit in the event; it is easier to store zero as the 'default' case and only store a nonzero when the operator is actually cross-type. Along the way, remove the long-since-defunct bigbox_ops operator class.
2003-11-10Remove rcsid CVS header variable --- not used.Bruce Momjian
2003-11-09Add operator strategy and comparison-value datatype fields to ScanKey.Tom Lane
Remove the 'strategy map' code, which was a large amount of mechanism that no longer had any use except reverse-mapping from procedure OID to strategy number. Passing the strategy number to the index AM in the first place is simpler and faster. This is a preliminary step in planned support for cross-datatype index operations. I'm committing it now since the ScanKeyEntryInitialize() API change touches quite a lot of files, and I want to commit those changes before the tree drifts under me.
2003-11-06Implement isolation levels read uncommitted and repeatable read as actingPeter Eisentraut
like the next higher one.
2003-10-31Fix for possible referential integrity violation when a qualified ON INSERTJan Wieck
rule split the query into one INSERT and one UPDATE where the UPDATE then hit's the just created row without modifying the key fields again. In this special case, the new key slipped in totally unchecked. Jan
2003-10-29Fix some corner cases in ACL manipulation: don't foul up on an emptyTom Lane
ACL array, and force languages to be treated as owned by the bootstrap user ID. (pg_language should have a lanowner column, but until it does this will have to do as a workaround.)
2003-10-16Avoid division by zero in estimate_num_groups() when table has no rows.Tom Lane
2003-10-06During ALTER TABLE ADD FOREIGN KEY, try to check the existing rows usingTom Lane
a single LEFT JOIN query instead of firing the check trigger for each row individually. Stephan Szabo, with some kibitzing from Tom Lane and Jan Wieck.
2003-10-04Fix pg_get_constraintdef() to ensure CHECK constraints are always shownTom Lane
with required outer parentheses. Breakage seems to be leftover from domain-constraint patches. This could be smarter about suppressing extra parens, but at this stage of the release cycle I want certainty not cuteness.
2003-10-02When dumping CREATE INDEX, must show opclass name if the opclass isn'tTom Lane
in the schema search path. Otherwise pg_dump doesn't correctly dump scenarios where a custom opclass is created in 'public' and then used by indexes in other schemas.
2003-10-01Repair RI trigger visibility problems (this time for sure ;-)) per recentTom Lane
discussion on pgsql-hackers: in READ COMMITTED mode we just have to force a QuerySnapshot update in the trigger, but in SERIALIZABLE mode we have to run the scan under a current snapshot and then complain if any rows would be updated/deleted that are not visible in the transaction snapshot.
2003-09-29The brackets aren't put on the CHECK constraints properly.Bruce Momjian
Before patch: test=# select pg_get_constraintdef(oid) from pg_constraint; pg_get_constraintdef ------------------------------------------------------------------------------------------------- CHECK (VALUE >= 0) CHECK ((((a)::text = 'asdf'::text) OR ((a)::text = 'fdsa'::text)) OR ((a)::text = 'dfd'::text)) PRIMARY KEY (b) FOREIGN KEY (a) REFERENCES test2(b) UNIQUE (b) (5 rows) test=# select pg_get_constraintdef(oid, true) from pg_constraint; pg_get_constraintdef ----------------------------------------------------------------------------------- CHECK VALUE >= 0 CHECK a::text = 'asdf'::text OR a::text = 'fdsa'::text OR a::text = 'dfd'::text PRIMARY KEY (b) FOREIGN KEY (a) REFERENCES test2(b) UNIQUE (b) (5 rows) After patch: test=# select pg_get_constraintdef(oid) from pg_constraint; pg_get_constraintdef ------------------------------------------------------------------------------------------------- CHECK (VALUE >= 0) CHECK ((((a)::text = 'asdf'::text) OR ((a)::text = 'fdsa'::text)) OR ((a)::text = 'dfd'::text)) PRIMARY KEY (b) FOREIGN KEY (a) REFERENCES test2(b) UNIQUE (b) (5 rows) test=# select pg_get_constraintdef(oid, true) from pg_constraint; pg_get_constraintdef ----------------------------------------------------------------------------------- CHECK (VALUE >= 0) ` CHECK (a::text = 'asdf'::text OR a::text = 'fdsa'::text OR a::text = 'dfd'::text) PRIMARY KEY (b) FOREIGN KEY (a) REFERENCES test2(b) UNIQUE (b) (5 rows) It's important that those brackets are there to (a) match all other constraints and (b) so that people can just copy and paste them and it will work as SQL. Christopher Kings-Lynne
2003-09-29More message editing, some suggested by Alvaro HerreraPeter Eisentraut
2003-09-28Now that we have UPDATE tab SET col = DEFAULT, get rid of horrid hackTom Lane
in the RI triggers for ON DELETE/UPDATE SET DEFAULT. The code depended way too much on knowledge of plan structure, and yet still would fail if the generated query got rewritten by rules.
2003-09-26Various message fixes, among those fixes for the previous round of fixesPeter Eisentraut
2003-09-25Get rid of ReferentialIntegritySnapshotOverride by extending Executor APITom Lane
to allow es_snapshot to be set to SnapshotNow rather than a query snapshot. This solves a bug reported by Wade Klaver, wherein triggers fired as a result of RI cascade updates could misbehave.
2003-09-25Message editing: remove gratuitous variations in message wording, standardizePeter Eisentraut
terms, add some clarifications, fix some untranslatable attempts at dynamic message building.
2003-09-15OK, some of these syntax errors should be given other codes.Peter Eisentraut
2003-09-13Okay, I've had it with mktime() bugs. While chasing Torello Querci'sTom Lane
recent gripe, I discovered not one but two undocumented, undesirable behaviors of glibc's mktime. So, stop using it entirely, and always rely on inversion of localtime() to determine the local time zone. It's not even very much slower, as it turns out that mktime (at least in the glibc implementation) also does repeated reverse-conversions.
2003-09-09Some "feature not supported" errors are better syntax errors, because thePeter Eisentraut
feature they complain about isn't a feature or cannot be implemented without definitional changes.
2003-09-03Repair problems with to_char() overrunning its input string.Tom Lane
From Karel Zak.
2003-08-27Adjust date/time input parsing code to correctly distinguish the fourTom Lane
SQLSTATE error codes required by SQL99 (invalid format, datetime field overflow, interval field overflow, invalid time zone displacement value). Also emit a HINT about DateStyle in cases where it seems appropriate. Per recent gripes.