summaryrefslogtreecommitdiff
path: root/src/backend/parser
AgeCommit message (Collapse)Author
2006-10-04pgindent run for 8.2.Bruce Momjian
2006-09-28Fix IS NULL and IS NOT NULL tests on row-valued expressions to conform toTom Lane
the SQL spec, viz IS NULL is true if all the row's fields are null, IS NOT NULL is true if all the row's fields are not null. The former coding got this right for a limited number of cases with IS NULL (ie, those where it could disassemble a ROW constructor at parse time), but was entirely wrong for IS NOT NULL. Per report from Teodor. I desisted from changing the behavior for arrays, since on closer inspection it's not clear that there's any support for that in the SQL spec. This probably needs more consideration.
2006-09-25Fix notice message from DROP FUNCTION IF EXISTS, and improve messageTom Lane
for DROP AGGREGATE IF EXISTS. Per report from Teodor.
2006-09-22Fix bugs in plpgsql and ecpg caused by assuming that isspace() would onlyTom Lane
return true for exactly the characters treated as whitespace by their flex scanners. Per report from Victor Snezhko and subsequent investigation. Also fix a passel of unsafe usages of <ctype.h> functions, that is, ye olde char-vs-unsigned-char issue. I won't miss <ctype.h> when we are finally able to stop using it.
2006-09-18Fix problems with column name list of CREATE TABLE AS being applied toTom Lane
the input query's target list too soon, causing it to affect processing of ORDER BY in the input query.
2006-09-18Fix CREATE TABLE ... AS VALUES ... to work rather than Assert'ing;Tom Lane
oversight in original implementation of VALUES. Also fix an oversight in recent addition of options to CREATE TABLE AS: they weren't getting propagated if the query was a set-operation such as UNION.
2006-09-03Code review for UPDATE SET (columnlist) patch. Make it handle as muchTom Lane
of the syntax as this fundamentally dead-end approach can, in particular combinations of single and multi column assignments. Improve rather inadequate documentation and provide some regression tests.
2006-09-03Revert FETCH/MOVE int64 patch. Was using incorrect checks forBruce Momjian
fetch/move in scan.l.
2006-09-03Remove unnecessary copyObject() call in update (values) code.Bruce Momjian
2006-09-02Small code cleanup for recent UPDATE SET (values) patch.Bruce Momjian
2006-09-02Add UPDATE tab SET ROW (col, ...) = (val, ...) for updatingBruce Momjian
multiple columns Susanne Ebrecht
2006-09-02Change FETCH/MOVE to use int8.Bruce Momjian
Dhanaraj M
2006-08-30Extend COPY to support COPY (SELECT ...) TO ...Tom Lane
Bernd Helmle
2006-08-25Add the ability to create indexes 'concurrently', that is, withoutTom Lane
blocking concurrent writes to the table. Greg Stark, with a little help from Tom Lane.
2006-08-21Fix all known problems with pg_dump's handling of serial sequencesTom Lane
by abandoning the idea that it should say SERIAL in the dump. Instead, dump serial sequences and column defaults just like regular ones. Add a new backend command ALTER SEQUENCE OWNED BY to let pg_dump recreate the sequence-to-column dependency that was formerly created "behind the scenes" by SERIAL. This restores SERIAL to being truly "just a macro" consisting of component operations that can be stated explicitly in SQL. Furthermore, the new command allows sequence ownership to be reassigned, so that old mistakes can be cleaned up. Also, downgrade the OWNED-BY dependency from INTERNAL to AUTO, since there is no longer any very compelling argument why the sequence couldn't be dropped while keeping the column. (This forces initdb, to be sure the right kinds of dependencies are in there.) Along the way, add checks to prevent ALTER OWNER or SET SCHEMA on an owned sequence; you can now only do this indirectly by changing the owning table's owner or schema. This is an oversight in previous releases, but probably not worth back-patching.
2006-08-14Cause '*' and 'foo.*' notations to mark the referenced RTE(s) asTom Lane
requiring read permissions. Up till now there was no possible case in which the RTEs wouldn't already have ACL_SELECT set ... but now that you can say something like 'INSERT INTO foo ... RETURNING *' this is an essential step. With this commit, a RETURNING clause adds the requirement for SELECT permissions on the target table if and only if the clause actually reads the value of at least one target-table column.
2006-08-12Tweak SPI_cursor_open to allow INSERT/UPDATE/DELETE RETURNING; this wasTom Lane
merely a matter of fixing the error check, since the underlying Portal infrastructure already handles it. This in turn allows these statements to be used in some existing plpgsql and plperl contexts, such as a plpgsql FOR loop. Also, do some marginal code cleanup in places that were being sloppy about distinguishing SELECT from SELECT INTO.
2006-08-12Remove ancient, obsolete comment.Tom Lane
2006-08-12Add INSERT/UPDATE/DELETE RETURNING, with basic docs and regression tests.Tom Lane
plpgsql support to come later. Along the way, convert execMain's SELECT INTO support into a DestReceiver, in order to eliminate some ugly special cases. Jonah Harris and Tom Lane
2006-08-10Fix UNION/INTERSECT/EXCEPT so that when two inputs being merged haveTom Lane
same data type and same typmod, we show that typmod as the output typmod, rather than generic -1. This responds to several complaints over the past few years about UNIONs unexpectedly dropping length or precision info.
2006-08-02Wups, got the test for contain_vars_of_level-not-needed wrong inTom Lane
transformInsertStmt: the target table is already in p_rtable at that point.
2006-08-02Add a HINT per suggestion from Michael Glaesemann. Also, tweak OLD/NEWTom Lane
test to avoid expensive contain_vars_of_level() scan in the normal case where we're not inside a rule.
2006-08-02Add support for multi-row VALUES clauses as part of INSERT statementsJoe Conway
(e.g. "INSERT ... VALUES (...), (...), ...") and elsewhere as allowed by the spec. (e.g. similar to a FROM clause subselect). initdb required. Joe Conway and Tom Lane.
2006-07-31Change the bootstrap sequence so that toast tables for system catalogs areTom Lane
created in the bootstrap phase proper, rather than added after-the-fact by initdb. This is cleaner than before because it allows us to retire the undocumented ALTER TABLE ... CREATE TOAST TABLE command, but the real reason I'm doing it is so that toast tables of shared catalogs will now have predetermined OIDs. This will allow a reasonably clean solution to the problem of locking tables before we load their relcache entries, to appear in a forthcoming patch.
2006-07-27Aggregate functions now support multiple input arguments. I also tookTom Lane
the opportunity to treat COUNT(*) as a zero-argument aggregate instead of the old hack that equated it to COUNT(1); this is materially cleaner (no more weird ANYOID cases) and ought to be at least a tiny bit faster. Original patch by Sergey Koposov; review, documentation, simple regression tests, pg_dump and psql support by moi.
2006-07-26Code review for bigint-LIMIT patch. Fix missed planner dependency,Tom Lane
eliminate unnecessary code, force initdb because stored rules change (limit nodes are now supposed to be int8 not int4 expressions). Update comments and error messages, which still all said 'integer'.
2006-07-26Change LIMIT/OFFSET to use int8Bruce Momjian
Dhanaraj M
2006-07-15Fix some missing inclusions identified with new pgcheckdefines tool.Tom Lane
2006-07-14Remove 576 references of include files that were not needed.Bruce Momjian
2006-07-13Allow include files to compile own their own.Bruce Momjian
Strip unused include files out unused include files, and add needed includes to C files. The next step is to remove unused include files in C files.
2006-07-11Sort reference of include files, "A" - "F".Bruce Momjian
2006-07-03Code review for FILLFACTOR patch. Change WITH grammar as per earlierTom Lane
discussion (including making def_arg allow reserved words), add missed opt_definition for UNIQUE case. Put the reloptions support code in a less random place (I chose to make a new file access/common/reloptions.c). Eliminate header inclusion creep. Make the index options functions safely user-callable (seems like client apps might like to be able to test validity of options before trying to make an index). Reduce overhead for normal case with no options by allowing rd_options to be NULL. Fix some unmaintainably klugy code, including getting rid of Natts_pg_class_fixed at long last. Some stylistic cleanup too, and pay attention to keeping comments in sync with code. Documentation still needs work, though I did fix the omissions in catalogs.sgml and indexam.sgml.
2006-07-02Add FILLFACTOR to CREATE INDEX.Bruce Momjian
ITAGAKI Takahiro
2006-07-02ALTER TABLE ... ADD/DROPS INHERIT (actually INHERIT / NO INHERIT)Bruce Momjian
Open items: There were a few tangentially related issues that have come up that I think are TODOs. I'm likely to tackle one or two of these next so I'm interested in hearing feedback on them as well. . Constraints currently do not know anything about inheritance. Tom suggested adding a coninhcount and conislocal like attributes have to track their inheritance status. . Foreign key constraints currently do not get copied to new children (and therefore my code doesn't verify them). I don't think it would be hard to add them and treat them like CHECK constraints. . No constraints at all are copied to tables defined with LIKE. That makes it hard to use LIKE to define new partitions. The standard defines LIKE and specifically says it does not copy constraints. But the standard already has an option called INCLUDING DEFAULTS; we could always define a non-standard extension LIKE table INCLUDING CONSTRAINTS that gives the user the option to request a copy including constraints. . Personally, I think the whole attislocal thing is bunk. The decision about whether to drop a column from children tables or not is something that should be up to the user and trying to DWIM based on whether there was ever a local definition or the column was acquired purely through inheritance is hardly ever going to match up with user expectations. . And of course there's the whole unique and primary key constraint issue. I think to get any traction at all on this you have a prerequisite of a real partitioned table implementation where the system knows what the partition key is so it can recognize when it's a leading part of an index key. Greg Stark
2006-06-27Add INCLUDING CONSTRAINTS to CREATE TABLE LIKE.Bruce Momjian
Greg Stark
2006-06-26Change the row constructor syntax (ROW(...)) so that list elements foo.*Tom Lane
will be expanded to a list of their member fields, rather than creating a nested rowtype field as formerly. (The old behavior is still available by omitting '.*'.) This syntax is not allowed by the SQL spec AFAICS, so changing its behavior doesn't violate the spec. The new behavior is substantially more useful since it allows, for example, triggers to check for data changes with 'if row(new.*) is distinct from row(old.*)'. Per my recent proposal.
2006-06-21Disallow aggregate functions in UPDATE commands (unless within a sub-SELECT).Tom Lane
This is disallowed by the SQL spec because it doesn't have any very sensible interpretation. Historically Postgres has allowed it but behaved strangely. As of PG 8.1 a server crash is possible if the MIN/MAX index optimization gets applied; rather than try to "fix" that, it seems best to just enforce the spec restriction. Per report from Josh Drake and Alvaro Herrera.
2006-06-16Fix a couple of obvious problems in DROP IF EXISTS patch.Tom Lane
2006-06-16DROP ... IF EXISTS for the following cases:Andrew Dunstan
language, tablespace, trigger, rule, opclass, function, aggregate. operator, and cast.
2006-06-16Fix problems with cached tuple descriptors disappearing while still in useTom Lane
by creating a reference-count mechanism, similar to what we did a long time ago for catcache entries. The back branches have an ugly solution involving lots of extra copies, but this way is more efficient. Reference counting is only applied to tupdescs that are actually in caches --- there seems no need to use it for tupdescs that are generated in the executor, since they'll go away during plan shutdown by virtue of being in the per-query memory context. Neil Conway and Tom Lane
2006-05-27Re-introduce the yylex filter function formerly used to support UNIONTom Lane
JOIN, which I removed in a recent fit of over-optimism that we wouldn't have any future use for it. Now it's needed to support disambiguating WITH CHECK OPTION from WITH TIME ZONE. As proof of concept, add stub grammar productions for WITH CHECK OPTION.
2006-05-21Add a new GUC parameter backslash_quote, which determines whether the SQLTom Lane
parser will allow "\'" to be used to represent a literal quote mark. The "\'" representation has been deprecated for some time in favor of the SQL-standard representation "''" (two single quote marks), but it has been used often enough that just disallowing it immediately won't do. Hence backslash_quote allows the settings "on", "off", and "safe_encoding", the last meaning to allow "\'" only if client_encoding is a valid server encoding. That is now the default, and the reason is that in encodings such as SJIS that allow 0x5c (ASCII backslash) to be the last byte of a multibyte character, accepting "\'" allows SQL-injection attacks as per CVE-2006-2314 (further details will be published after release). The "on" setting is available for backward compatibility, but it must not be used with clients that are exposed to untrusted input. Thanks to Akio Ishida and Yasuo Ohgaki for identifying this security issue.
2006-05-11Code review for standard_conforming_strings patch. Fix it so it does notTom Lane
throw warnings for 100%-SQL-standard constructs, clean up some minor infelicities, try to un-break ecpg to the best of my ability. (It's not clear how ecpg is going to find out the setting of standard_conforming_strings, though.) I think pg_dump still needs work, too.
2006-05-01Provide a namespace.c function for lookup of an operator with exactTom Lane
input datatypes given, and use this before trying OpernameGetCandidates. This is faster than the old method when there's an exact match, and it does not seem materially slower when there's not. And it definitely makes some of the callers cleaner, because they didn't really want to know about a list of candidates anyway. Per discussion with Atsushi Ogawa.
2006-04-30Improve the representation of FOR UPDATE/FOR SHARE so that we canTom Lane
support both FOR UPDATE and FOR SHARE in one command, as well as both NOWAIT and normal WAIT behavior. The more general code is actually simpler and cleaner.
2006-04-27Use schema search path to find the first matching contraint name for SETBruce Momjian
CONSTRAINT, rather than affecting all constraints in all schemas (which is what we used to do). Also allow schema specifications. Kris Jurka
2006-04-25Back out RESET CONNECTION until there is more discussion.Bruce Momjian
2006-04-25Add RESET CONNECTION, to reset all aspects of a session.Bruce Momjian
Hans-J?rgen Sch?nig
2006-04-24Back out patch, unintended.Bruce Momjian
2006-04-24Done:Bruce Momjian
o -Add support for day-time syntax, INTERVAL '1 2:03:04' DAY TO SECOND