aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
Commit message (Collapse)AuthorAge
...
* Adds in NO MAXVALUE and NO MINVALUE options for create sequence per 200XBruce Momjian2003-02-13
| | | | | | | | | spec, which will also make alter sequence a touch easier. sequence.c init_params() will check for settings which have been defined twice, and complain. Rod Taylor
* Code for WITHOUT OIDS.Bruce Momjian2003-02-13
| | | | | | | | | On Wed, 2003-01-08 at 21:59, Christopher Kings-Lynne wrote: > I agree. I want to remove OIDs from heaps of our tables when we go to 7.3. > I'd rather not have to do it in the dump due to down time. Rod Taylor <rbt@rbt.ca>
* > =================================================================Bruce Momjian2003-02-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > User interface proposal for multi-row function targetlist entries > ================================================================= > 1. Only one targetlist entry may return a set. > 2. Each targetlist item (other than the set returning one) is > repeated for each item in the returned set. > Having gotten no objections (actually, no response at all), I can only assume no one had heartburn with this change. The attached patch covers the first of the two proposals, i.e. restricting the target list to only one set returning function. It compiles cleanly, and passes all regression tests. If there are no objections, please apply. Any suggestions on where this should be documented (other than maybe sql-select)? Thanks, Joe p.s. Here's what the previous example now looks like: CREATE TABLE bar(f1 int, f2 text, f3 int); INSERT INTO bar VALUES(1, 'Hello', 42); INSERT INTO bar VALUES(2, 'Happy', 45); CREATE TABLE foo(a int, b text); INSERT INTO foo VALUES(42, 'World'); INSERT INTO foo VALUES(42, 'Everyone'); INSERT INTO foo VALUES(45, 'Birthday'); INSERT INTO foo VALUES(45, 'New Year'); CREATE TABLE foo2(a int, b text); INSERT INTO foo2 VALUES(42, '!!!!'); INSERT INTO foo2 VALUES(42, '????'); INSERT INTO foo2 VALUES(42, '####'); INSERT INTO foo2 VALUES(45, '$$$$'); CREATE OR REPLACE FUNCTION getfoo(int) RETURNS SETOF text AS ' SELECT b FROM foo WHERE a = $1 ' language 'sql'; CREATE OR REPLACE FUNCTION getfoo2(int) RETURNS SETOF text AS ' SELECT b FROM foo2 WHERE a = $1 ' language 'sql'; regression=# SELECT f1, f2, getfoo(f3) AS f4 FROM bar; f1 | f2 | f4 ----+-------+---------- 1 | Hello | World 1 | Hello | Everyone 2 | Happy | Birthday 2 | Happy | New Year (4 rows) regression=# SELECT f1, f2, getfoo(f3) AS f4, getfoo2(f3) AS f5 FROM bar; ERROR: Only one target list entry may return a set result Joe Conway
* Use a varno not chosen at random for dummy variables in the top-levelTom Lane2003-02-11
| | | | | | | | | targetlist of a set-operation tree. I'm not sure that this solution will really stand the test of time --- perhaps we need to make a special RTE for such vars to refer to. But this quick hack fixes Brandon Craig Rhodes' complaint of 10-Feb-02 about EXCEPT in CREATE RULE, while not changing any behavior in the better-tested cases where leftmostRTI is one anyway.
* Get rid of last few vestiges of parsetree dependency on grammar tokenTom Lane2003-02-10
| | | | | | codes, per discussion from last March. parse.h should now be included *only* by gram.y, scan.l, keywords.c, parser.c. This prevents surprising misbehavior after seemingly-trivial grammar adjustments.
* Create a distinction between Lists of integers and Lists of OIDs, to getTom Lane2003-02-09
| | | | | | rid of the assumption that sizeof(Oid)==sizeof(int). This is one small step towards someday supporting 8-byte OIDs. For the moment, it doesn't do much except get rid of a lot of unsightly casts.
* Replace planner's representation of relation sets, per pghackers discussion.Tom Lane2003-02-08
| | | | | Instead of Lists of integers, we now store variable-length bitmap sets. This should be faster as well as less error-prone.
* Allow qualified type names in CREATE CAST, DROP CAST. Also allow theTom Lane2003-02-05
| | | | | construction 'SETOF type[]' which for some reason was previously overlooked (you'd have to name the array type directly to make it work).
* Determine the set of constraints applied to a domain at executorTom Lane2003-02-03
| | | | | | startup, not in the parser; this allows ALTER DOMAIN to work correctly with domain constraint operations stored in rules. Rod Taylor; code review by Tom Lane.
* Change MOVE LAST to MOVE ALL.Bruce Momjian2003-02-03
| | | | Standard says FETCH LAST is after last row, and we don't do that.
* Implement EXPLAIN EXECUTE. By Neil Conway, with some kibitzing fromTom Lane2003-02-02
| | | | Tom Lane.
* Tweak bison build rules so that we get the same error messages fromTom Lane2003-01-31
| | | | | | | | bison 1.875 and later as we did from earlier bison releases. Eventually we will probably want to adopt the newer message spelling ... but not yet. Per recent discussion on pgpatches. Note: I didn't change the build rules for bootstrap, ecpg, or plpgsql grammars, since these do not affect regression test results.
* Grant options, and cascading revoke. Grant options are allowed only forPeter Eisentraut2003-01-23
| | | | | users right now, not groups. Extension of has_foo_privileges functions to query the grant options. Extension of aclitem type to store grantor.
* Fix parse_agg.c to detect ungrouped Vars in sub-SELECTs; remove codeTom Lane2003-01-17
| | | | | | | that used to do it in planner. That was an ancient kluge that was never satisfactory; errors should be detected at parse time when possible. But at the time we didn't have the support mechanism (expression_tree_walker et al) to make it convenient to do in the parser.
* Recent changes in sublink representation require exprType() to acceptTom Lane2003-01-13
| | | | SubPlan nodes, else explaining queries containing sublinks may fail.
* Read-only transactions, as defined in SQL.Peter Eisentraut2003-01-10
|
* Further tweaking of parsetree & plantree representation of SubLinks.Tom Lane2003-01-10
| | | | | | | Simplify SubLink by storing just a List of operator OIDs, instead of a list of incomplete OpExprs --- that was a bizarre and bulky choice, with no redeeming social value since we have to build new OpExprs anyway when forming the plan tree.
* Add optional drop behavior clause to REVOKE command, for SQL conformance.Peter Eisentraut2003-01-10
| | | | Currently, only RESTRICT is allowed.
* Adjust parser so that 'x NOT IN (subselect)' is converted toTom Lane2003-01-09
| | | | | | | | | | | 'NOT (x IN (subselect))', that is 'NOT (x = ANY (subselect))', rather than 'x <> ALL (subselect)' as we formerly did. This opens the door to optimizing NOT IN the same way as IN, whereas there's no hope of optimizing the expression using <>. Also, convert 'x <> ALL (subselect)' to the NOT(IN) style, so that the optimization will be available when processing rules dumped by older Postgres versions. initdb forced due to small change in SubLink node representation.
* Code review for FETCH/MOVE 0 changes. Improve documentation, do theTom Lane2003-01-08
| | | | | right thing with the destination when FETCH 0 can't return a row, don't try to stuff LONG_MAX into an int value.
* ALTER DOMAIN OWNER, from Rod Taylor.Tom Lane2003-01-06
|
* Enforces NOT NULL constraints to be applied against new PRIMARY KEYTom Lane2003-01-02
| | | | | | | | | columns in DefineIndex. So, ALTER TABLE ... PRIMARY KEY will now automatically add the NOT NULL constraint. It appeared the alter_table regression test wanted this to occur, as after the change the regression test better matched in inline 'fails'/'succeeds' comments. Rod Taylor
* Cause FETCH 1 to return the current cursor row, or zero if atBruce Momjian2002-12-30
| | | | | | | | | | | | beginning/end of cursor. Have MOVE return 0/1 depending on cursor position. Matches SQL spec. Pass cursor counter from parser as a long rather than int. Doc updates.
* Deliver better error message when a relation name is used in an expression.Tom Lane2002-12-27
| | | | Per report from Ian Barwick.
* To suppress memory leakage in long-lived Lists, lremove() should pfreeTom Lane2002-12-17
| | | | | the cons cell it's deleting from the list. Do this, and fix a few callers that were bogusly assuming it wouldn't free the cons cell.
* Fix ALTER TABLE ADD COLUMN to disallow the same column types that areTom Lane2002-12-16
| | | | | | | | disallowed by CREATE TABLE (eg, pseudo-types); also disallow these types from being introduced by the range-function syntax. While at it, allow CREATE TABLE to create zero-column tables, per recent pghackers discussion. I am back-patching this into 7.3 since failure to disallow pseudo-types is arguably a security hole.
* Phase 3 of read-only-plans project: ExecInitExpr now builds expressionTom Lane2002-12-13
| | | | | | | execution state trees, and ExecEvalExpr takes an expression state tree not an expression plan tree. The plan tree is now read-only as far as the executor is concerned. Next step is to begin actually exploiting this property.
* Preliminary code review for domain CHECK constraints patch: add documentation,Tom Lane2002-12-12
| | | | | | | | make VALUE a non-reserved word again, use less invasive method of passing ConstraintTestValue into transformExpr, fix problems with nested constraint testing, do correct thing with NULL result from a constraint expression, remove memory leak. Domain checks still need much more work if we are going to allow ALTER DOMAIN, however.
* Phase 2 of read-only-plans project: restructure expression-tree nodesTom Lane2002-12-12
| | | | | | | | | so that all executable expression nodes inherit from a common supertype Expr. This is somewhat of an exercise in code purity rather than any real functional advance, but getting rid of the extra Oper or Func node formerly used in each operator or function call should provide at least a little space and speed improvement. initdb forced by changes in stored-rules representation.
* Re-addd Rod's ALTER DOMAIN patch.Bruce Momjian2002-12-06
|
* Back out ALTER DOMAIN patch until missing file appears.Bruce Momjian2002-12-06
|
* ALTER DOMAIN .. SET / DROP NOT NULLBruce Momjian2002-12-06
| | | | | | | | | | ALTER DOMAIN .. SET / DROP DEFAULT ALTER DOMAIN .. ADD / DROP CONSTRAINT New files: - doc/src/sgml/ref/alter_domain.sgml Rod Taylor
* Code review for IS DISTINCT FROM patch. Fix incorrect constant-foldingTom Lane2002-11-30
| | | | | | logic, dissuade planner from thinking that 'x IS DISTINCT FROM 42' may be optimized into 'x = 42' (!!), cause dependency on = operator to be recorded correctly, minor other improvements.
* Missed one place that can be simplified after recent Param/Const cleanup.Tom Lane2002-11-30
|
* Tighten selection of equality and ordering operators for groupingTom Lane2002-11-29
| | | | | | | operations: make sure we use operators that are compatible, as determined by a mergejoin link in pg_operator. Also, add code to planner to ensure we don't try to use hashed grouping when the grouping operators aren't marked hashable.
* Use Params, rather than run-time-modified Const nodes, to handleTom Lane2002-11-26
| | | | | | | sublink results and COPY's domain constraint checking. A Const that isn't really constant is just a Bad Idea(tm). Remove hacks in parse_coerce and other places that were needed because of the former klugery.
* Remove unused constisset and constiscast fields of Const nodes. CleanTom Lane2002-11-25
| | | | up code and documentation associated with Param nodes.
* Un-break triggers declared for INSERT OR DELETE OR UPDATE. This workedTom Lane2002-11-25
| | | | | okay in 7.3, so I think it must have been busted in the recent triggers patch.
* This patch implements FOR EACH STATEMENT triggers, per my email toBruce Momjian2002-11-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -hackers a couple days ago. Notes/caveats: - added regression tests for the new functionality, all regression tests pass on my machine - added pg_dump support - updated PL/PgSQL to support per-statement triggers; didn't look at the other procedural languages. - there's (even) more code duplication in trigger.c than there was previously. Any suggestions on how to refactor the ExecXXXTriggers() functions to reuse more code would be welcome -- I took a brief look at it, but couldn't see an easy way to do it (there are several subtly-different versions of the code in question) - updated the documentation. I also took the liberty of removing a big chunk of duplicated syntax documentation in the Programmer's Guide on triggers, and moving that information to the CREATE TRIGGER reference page. - I also included some spelling fixes and similar small cleanups I noticed while making the changes. If you'd like me to split those into a separate patch, let me know. Neil Conway
* Remove ALL from CLUSTER ALL. Use just CLUSTER.Bruce Momjian2002-11-18
|
* New version attached. The following is implemented:Bruce Momjian2002-11-15
| | | | | | | | | | | - CLUSTER ALL clusters all the tables that have some index with indisclustered set and the calling user owns. - CLUSTER tablename clusters the named table, using the index with indisclustered set. If no index has the bit set, throws elog(ERROR). - The multi-relation version (CLUSTER ALL) uses a multitransaction approach, similar to what VACUUM does. Alvaro Herrera
* Add DOMAIN check constraints.Bruce Momjian2002-11-15
| | | | Rod Taylor
* Make MOVE/FETCH 0 actually move/fetch 0. Add MOVE LAST to move to endBruce Momjian2002-11-13
| | | | of cursor.
* Add new palloc0 call as merge of palloc and MemSet(0).Bruce Momjian2002-11-13
|
* Code review for ON COMMIT patch. Make the actual on-commit action happenTom Lane2002-11-11
| | | | | | | | | before commit, not after :-( --- the original coding is not only unsafe if an error occurs while it's processing, but it generates an invalid sequence of WAL entries. Resurrect 7.2 logic for deleting items when no longer needed. Use an enum instead of random macros. Editorialize on names used for routines and constants. Teach backend/nodes routines about new field in CreateTable struct. Add a regression test.
* Add cast to suppress compile warning on Alphas.Tom Lane2002-11-11
|
* Back out use of palloc0 in place if palloc/MemSet. Seems constant lenBruce Momjian2002-11-11
| | | | to MemSet is a performance boost.
* Merge palloc()/MemSet(0) calls into a single palloc0() call.Bruce Momjian2002-11-10
|
* Tweak CREATE SEQUENCE grammar to be more SQL1999 standards compliant.Bruce Momjian2002-11-10
| | | | Neil Conway
* Add code to handle [ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP }]Bruce Momjian2002-11-09
| | | | | | for temp tables. Gavin Sherry