summaryrefslogtreecommitdiff
path: root/src/backend/parser
AgeCommit message (Collapse)Author
2009-01-12Use qualified_name instead of relation_expr for commands that have noPeter Eisentraut
business with inheritance recursion: ALTER INDEX, ALTER SEQUENCE, ALTER TRIGGER, ALTER VIEW. They would just silently ignore the ONLY. ALTER TABLE has mixed behavior and cannot be dealt with this way because of the resulting shift/reduce conflicts.
2009-01-12Add ONLY support to LOCK and TRUNCATE. By default, these commands are nowPeter Eisentraut
recursive. => Note this incompatibility in the release notes.
2009-01-08Defend against null input in analyze_requires_snapshot(), per reportTom Lane
from Rushabh Lathia.
2009-01-07Add comment about why BETWEEN uses operator strings and not opclasses,Bruce Momjian
with URL pointing to email discussion.
2009-01-01Update copyright for 2009.Bruce Momjian
2008-12-31Throw error if a <window definition> references a window that already has aTom Lane
frame clause, as appears to be required by the fine print in the SQL spec. Per discussion with Pavel, not doing so risks user confusion.
2008-12-31Add a WINDOW attribute to CREATE FUNCTION, and teach pg_dump about it,Tom Lane
so that user-defined window functions are possible. For the moment you'll have to write them in C, for lack of any interface to the WindowObject API in the available PLs, but it's better than no support at all. There was some debate about the best syntax for this. I ended up choosing the "it's an attribute" position --- the other approach will inevitably be more work, and the likely market for user-defined window functions is probably too small to justify it.
2008-12-31Add some basic support for window frame clauses to the window-functionsTom Lane
patch. This includes the ability to force the frame to cover the whole partition, and the ability to make the frame end exactly on the current row rather than its last ORDER BY peer. Supporting any more of the full SQL frame-clause syntax will require nontrivial hacking on the window aggregate code, so it'll have to wait for 8.5 or beyond.
2008-12-28Support window functions a la SQL:2008.Tom Lane
Hitoshi Harada, with some kibitzing from Heikki and Tom.
2008-12-20Add missing semicolon, per buildfarm results. Martin PihlakTom Lane
2008-12-19SQL/MED catalog manipulation facilitiesPeter Eisentraut
This doesn't do any remote or external things yet, but it gives modules like plproxy and dblink a standardized and future-proof system for managing their connection information. Martin Pihlak and Peter Eisentraut
2008-12-18Code review for function default parameters patch. Fix numerous problems asTom Lane
per recent discussions. In passing this also fixes a couple of bugs in the previous variadic-parameters patch.
2008-12-17Don't reset pg_class.reltuples and relpages in VACUUM, if any pages wereHeikki Linnakangas
skipped. We could update relpages anyway, but it seems better to only update it together with reltuples, because we use the reltuples/relpages ratio in the planner. Also don't update n_live_tuples in pgstat. ANALYZE in VACUUM ANALYZE now needs to update pg_class, if the VACUUM-phase didn't do so. Added some boolean-passing to let analyze_rel know if it should update pg_class or not. I also moved the relcache invalidation (to update rd_targblock) from vac_update_relstats to where RelationTruncate is called, because vac_update_relstats is not called for partial vacuums anymore. It's more obvious to send the invalidation close to the truncation that requires it. Per report by Ned T. Crigler.
2008-12-14Restore enforce_generic_type_consistency's pre-8.3 behavior of allowing anTom Lane
actual argument type of ANYARRAY to match an argument declared ANYARRAY, so long as ANYELEMENT etc aren't used. I had overlooked the fact that this is a possible case while fixing bug #3852; but it is possible because pg_statistic contains columns declared ANYARRAY. Per gripe from Corey Horton.
2008-12-13Fix failure to ensure that a snapshot is available to datatype input functionsTom Lane
when they are invoked by the parser. We had been setting up a snapshot at plan time but really it needs to be done earlier, before parse analysis. Per report from Dmitry Koterov. Also fix two related problems discovered while poking at this one: exec_bind_message called datatype input functions without establishing a snapshot, and SET CONSTRAINTS IMMEDIATE could call trigger functions without establishing a snapshot. Backpatch to 8.2. The underlying problem goes much further back, but it is masked in 8.1 and before because we didn't attempt to invoke domain check constraints within datatype input. It would only be exposed if a C-language datatype input function used the snapshot; which evidently none do, or we'd have heard complaints sooner. Since this code has changed a lot over time, a back-patch is hardly risk-free, and so I'm disinclined to patch further than absolutely necessary.
2008-12-06Allow CREATE OR REPLACE VIEW to add columns to the _end_ of the view.Bruce Momjian
Robert Haas
2008-12-04Default values for function argumentsPeter Eisentraut
Pavel Stehule, with some tweaks by Peter Eisentraut
2008-12-04Utilize the visibility map in autovacuum, too. There was an oversight inHeikki Linnakangas
the visibility map patch that because autovacuum always sets VacuumStmt->freeze_min_age, visibility map was never used for autovacuum, only for manually launched vacuums. This patch introduces a new scan_all field to VacuumStmt, indicating explicitly whether the visibility map should be used, or the whole relation should be scanned, to advance relfrozenxid. Anti-wraparound vacuums still need to scan all pages.
2008-11-26Add %expect 0 to all parser input files to prevent conflicts slipping by.Peter Eisentraut
2008-11-24CLUSTER VERBOSE and corresponding clusterdb --verbose optionPeter Eisentraut
Jim Cox and Peter Eisentraut
2008-11-21Use relation_expr for TABLE command, requested by Tom.Peter Eisentraut
2008-11-20TABLE commandPeter Eisentraut
2008-11-15Make SELECT FOR UPDATE/SHARE work on inheritance trees, by having the planTom Lane
return the tableoid as well as the ctid for any FOR UPDATE targets that have child tables. All child tables are listed in the ExecRowMark list, but the executor just skips the ones that didn't produce the current row. Curiously, this longstanding restriction doesn't seem to have been documented anywhere; so no doc changes.
2008-11-13Removed two non-terminals:Michael Meskes
- FloatOnly: only used by NumericOnly, instead put the FloatOnly production into NumericOnly - IntegerOnly: only used by NumericOnly and one ALTER TABLE rule, replacement SignedIconst is already used in several other places
2008-11-12Do not use ICONST/SCONST in rules other than Iconst/Sconst.Michael Meskes
2008-11-07Implement ALTER DATABASE SET TABLESPACE to move a whole database (or at leastTom Lane
as much of it as lives in its default tablespace) to a new tablespace. Guillaume Lelarge, with some help from Bernd Helmle and Tom Lane
2008-10-31Added missing ';'Michael Meskes
2008-10-31Add support for user-defined I/O conversion casts.Heikki Linnakangas
2008-10-29Since SQL:2003, the array size specification in the SQL ARRAY syntax hasPeter Eisentraut
been optional.
2008-10-29Unicode escapes in strings and identifiersPeter Eisentraut
2008-10-28Add WITH [NO] DATA clause to CREATE TABLE AS, per SQL.Peter Eisentraut
Also, since WITH is now a reserved word, simplify the token merging code to only deal with WITH_TIME. by Tom Lane and myself
2008-10-27SQL:2008 syntax CURRENT_CATALOG, CURRENT_SCHEMA, SET CATALOG, SET SCHEMA.Peter Eisentraut
2008-10-27Allow EXPLAIN on CREATE TABLE AS.Peter Eisentraut
2008-10-26Better solution to the IN-list issue: instead of having an arbitrary cutoff,Tom Lane
treat Var and non-Var IN-list items differently. Only non-Var items are candidates to go into an ANY(ARRAY) construct --- we put all Vars as separate OR conditions on the grounds that that leaves more scope for optimization. Per suggestion from Robert Haas.
2008-10-25Add a heuristic to transformAExprIn() to make it prefer expanding "x IN (list)"Tom Lane
into an OR of equality comparisons, rather than x = ANY(ARRAY[...]), when there are Vars in the right-hand side. This avoids a performance regression compared to pre-8.2 releases, in cases where the OR form can be optimized into scans of multiple indexes. Limit the possible downside by preferring this form only when the list isn't very long (I set the cutoff at 32 elements, which is a bit arbitrary but in the right ballpark). Per discussion with Jim Nasby. In passing, also make it try the OR form if it cannot select a common type for the array elements; we've seen a complaint or two about how the OR form worked for such cases and ARRAY doesn't.
2008-10-22SQL:2008 alternative syntax for LIMIT/OFFSET:Peter Eisentraut
OFFSET num {ROW|ROWS} FETCH {FIRST|NEXT} [num] {ROW|ROWS} ONLY
2008-10-21Allow SQL:2008 syntax ALTER TABLE ... ALTER COLUMN ... SET DATA TYPEPeter Eisentraut
alongside our traditional syntax.
2008-10-20SQL 200N -> SQL:2003Peter Eisentraut
2008-10-13Implement comparison of generic records (composite types), and invent aTom Lane
pseudo-type record[] to represent arrays of possibly-anonymous composite types. Since composite datums carry their own type identification, no extra knowledge is needed at the array level. The main reason for doing this right now is that it is necessary to support the general case of detection of cycles in recursive queries: if you need to compare more than one column to detect a cycle, you need to compare a ROW() to an array built from ROW()s, at least if you want to do it as the spec suggests. Add some documentation and regression tests concerning the cycle detection issue.
2008-10-08Modify the parser's error reporting to include a specific hint for the caseTom Lane
of referencing a WITH item that's not yet in scope according to the SQL spec's semantics. This seems to be an easy error to make, and the bare "relation doesn't exist" message doesn't lead one's mind in the correct direction to fix it.
2008-10-07Extend CTE patch to support recursive UNION (ie, without ALL). TheTom Lane
implementation uses an in-memory hash table, so it will poop out for very large recursive results ... but the performance characteristics of a sort-based implementation would be pretty unpleasant too.
2008-10-07Improve parser error location for cases where an INSERT or UPDATE commandTom Lane
supplies an expression that can't be coerced to the target column type. The code previously attempted to point at the target column name, which doesn't work at all in an INSERT with omitted column name list, and is also not remarkably helpful when the problem is buried somewhere in a long INSERT-multi-VALUES command. Make it point at the failed expression instead.
2008-10-06When expanding a whole-row Var into a RowExpr during ResolveNew(), attachTom Lane
the column alias names of the RTE referenced by the Var to the RowExpr. This is needed to allow ruleutils.c to correctly deparse FieldSelect nodes referencing such a construct. Per my recent bug report. Adding a field to RowExpr forces initdb (because of stored rules changes) so this solution is not back-patchable; which is unfortunate because 8.2 and 8.3 have this issue. But it only affects EXPLAIN for some pretty odd corner cases, so we can probably live without a solution for the back branches.
2008-10-06Fix GetCTEForRTE() to deal with the possibility that the RTE it's given cameTom Lane
from a query level above the current ParseState.
2008-10-06Fix the implicit-RTE code to be able to handle implicit RTEs for CTEs, asTom Lane
well as regular tables. Per discussion, this seems necessary to meet the principle of least astonishment. In passing, simplify the error messages in warnAutoRange(). Now that we have parser error position info for these errors, it doesn't seem very useful to word the error message differently depending on whether we are inside a sub-select or not.
2008-10-05Improve behavior of WITH RECURSIVE with an untyped literal in theTom Lane
non-recursive term. Per an example from Dickson S. Guedes.
2008-10-05Fix markTargetListOrigin() to not fail on a simple-Var reference to aTom Lane
recursive CTE that we're still in progress of analyzing. Add a similar guard to the similar code in expandRecordVariable(), and tweak regression tests to cover this case. Per report from Dickson S. Guedes.
2008-10-04Implement SQL-standard WITH clauses, including WITH RECURSIVE.Tom Lane
There are some unimplemented aspects: recursive queries must use UNION ALL (should allow UNION too), and we don't have SEARCH or CYCLE clauses. These might or might not get done for 8.4, but even without them it's a pretty useful feature. There are also a couple of small loose ends and definitional quibbles, which I'll send a memo about to pgsql-hackers shortly. But let's land the patch now so we can get on with other development. Yoshiyuki Asaba, with lots of help from Tatsuo Ishii and Tom Lane
2008-09-23Make LC_COLLATE and LC_CTYPE database-level settings. Collation andHeikki Linnakangas
ctype are now more like encoding, stored in new datcollate and datctype columns in pg_database. This is a stripped-down version of Radek Strnad's patch, with further changes by me.
2008-09-11Adjust the parser to accept the typename syntax INTERVAL ... SECOND(n)Tom Lane
and the literal syntax INTERVAL 'string' ... SECOND(n), as required by the SQL standard. Our old syntax put (n) directly after INTERVAL, which was a mistake, but will still be accepted for backward compatibility as well as symmetry with the TIMESTAMP cases. Change intervaltypmodout to show it in the spec's way, too. (This could potentially affect clients, if there are any that analyze the typmod of an INTERVAL in any detail.) Also fix interval input to handle 'min:sec.frac' properly; I had overlooked this case in my previous patch. Document the use of the interval fields qualifier, which up to now we had never mentioned in the docs. (I think the omission was intentional because it didn't work per spec; but it does now, or at least close enough to be credible.)