summaryrefslogtreecommitdiff
path: root/src/backend/parser
Commit message (Collapse)AuthorAgeFilesLines
* Support USING INDEX TABLESPACE clause for PRIMARY KEY and UNIQUETom Lane2004-08-022-8/+21
| | | | constraints. Christopher Kings-Lynne.
* Replace nested-BEGIN syntax for subtransactions with spec-compliantTom Lane2004-07-272-6/+34
| | | | | | | SAVEPOINT/RELEASE/ROLLBACK-TO syntax. (Alvaro) Cause COMMIT of a failed transaction to report ROLLBACK instead of COMMIT in its command tag. (Tom) Fix a few loose ends in the nested-transactions stuff.
* Remove TABLESPACE option of CREATE SEQUENCE; sequences will now alwaysTom Lane2004-07-123-15/+8
| | | | | | | live in database or schema's default tablespace, as per today's discussion. Also, remove some unused keywords from the grammar (PATH, PENDANT, VERSION), and fix ALSO, which was added as a keyword but not added to the keyword classification lists, thus making it worse-than-reserved.
* ALTER TABLE SET TABLESPACE. Gavin Sherry, some rework by Tom Lane.Tom Lane2004-07-111-1/+9
|
* Remove some no-longer-needed #includes.Tom Lane2004-06-282-13/+6
|
* Fix some bogus code in ConstBit production --- it managed to work, butTom Lane2004-06-281-3/+3
| | | | | | only because 14627 still contained the same node that BitWithoutLength had just produced. Make it more transparent. Also adjust ConstCharacter to be coded the same way for consistency.
* Support renaming of tablespaces, and changing the owners ofTom Lane2004-06-251-23/+105
| | | | | | | | aggregates, conversions, functions, operators, operator classes, schemas, types, and tablespaces. Fold the existing implementations of alter domain owner and alter database owner in with these. Christopher Kings-Lynne
* Fix oversight in recent rowtype-handling improvements: transformTargetListTom Lane2004-06-192-121/+208
| | | | | | should recognize 'foo.*' when the star appears in A_Indirection, not only in ColumnRef. This allows 'SELECT something.*' to do what the user expects when the something is an expression yielding a row.
* Tablespaces. Alternate database locations are dead, long live tablespaces.Tom Lane2004-06-183-22/+95
| | | | | | | | | There are various things left to do: contrib dbsize and oid2name modules need work, and so does the documentation. Also someone should think about COMMENT ON TABLESPACE and maybe RENAME TABLESPACE. Also initlocation is dead, it just doesn't know it yet. Gavin Sherry and Tom Lane.
* Represent type-specific length coercion functions as pg_cast entries,Tom Lane2004-06-164-140/+203
| | | | | | | | | | | | | | | | | eliminating the former hard-wired convention about their names. Allow pg_cast entries to represent both type coercion and length coercion in a single step --- this is represented by a function that takes an extra typmod argument, just like a length coercion function. This nicely merges the type and length coercion mechanisms into something at least a little cleaner than we had before. Make use of the single- coercion-step behavior to fix integer-to-bit coercion so that coercing to bit(n) yields the rightmost n bits of the integer instead of the leftmost n bits. This should fix recurrent complaints about the odd behavior of this coercion. Clean up the documentation of the bit string functions, and try to put it where people might actually find it. Also, get rid of the unreliable heuristics in ruleutils.c about whether to display nested coercion steps; instead require parse_coerce.c to label them properly in the first place.
* Clean up generation of default names for constraints, indexes, and serialTom Lane2004-06-101-116/+20
| | | | | | | | sequences, as per recent discussion. All these names are now of the form table_column_type, with digits added if needed to make them unique. Default constraint names are chosen to be unique across their whole schema, not just within the parent object, so as to be more SQL-spec-compatible and make the information schema views more useful.
* Support assignment to subfields of composite columns in UPDATE and INSERT.Tom Lane2004-06-096-287/+626
| | | | | | | | As a side effect, cause subscripts in INSERT targetlists to do something more or less sensible; previously we evaluated such subscripts and then effectively ignored them. Another side effect is that UPDATE-ing an element or slice of an array value that is NULL now produces a non-null result, namely an array containing just the assigned-to positions.
* Infrastructure for I/O of composite types: arrange for the I/O routinesTom Lane2004-06-062-76/+13
| | | | | | | | | | of a composite type to get that type's OID as their second parameter, in place of typelem which is useless. The actual changes are mostly centralized in getTypeInputInfo and siblings, but I had to fix a few places that were fetching pg_type.typelem for themselves instead of using the lsyscache.c routines. Also, I renamed all the related variables from 'typelem' to 'typioparam' to discourage people from assuming that they necessarily contain array element types.
* Remove some long-obsolete code that was causing a strange error messageTom Lane2004-06-041-16/+3
| | | | | | | when someone attempts to create a column of a composite datatype. For now, just make sure we produce a reasonable error at the 'right place'. Not sure if this will be made to work before 7.5, but make it act reasonably in case nothing more gets done.
* Remove typeTypeFlag(), which was not only unused but entirely redundantTom Lane2004-06-031-11/+1
| | | | with typeTypType().
* OK, here's the final version of ALTER TABLE ... SET WITHOUT CLUSTER.Bruce Momjian2004-06-021-1/+9
| | | | | | Has docs + regression test. Christopher Kings-Lynne
* Some more de-FastList-ification.Tom Lane2004-06-012-29/+22
|
* Use the new List API function names throughout the backend, and disable theNeil Conway2004-05-3011-297/+297
| | | | | list compatibility API by default. While doing this, I decided to keep the llast() macro around and introduce llast_int() and llast_oid() variants.
* The patch adresses the TODO list item "Allow external interfaces toBruce Momjian2004-05-261-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | extend the GUC variable set". Plugin modules like the pl<lang> modules needs a way to declare configuration parameters. The postmaster has no knowledge of such modules when it reads the postgresql.conf file. Rather than allowing totally unknown configuration parameters, the concept of a variable "class" is introduced. Variables that belongs to a declared classes will create a placeholder value of string type and will not generate an error. When a module is loaded, it will declare variables for such a class and make those variables "consume" any placeholders that has been defined. Finally, the module will generate warnings for unrecognized placeholders defined for its class. More detail: The design is outlined after the suggestions made by Tom Lane and Joe Conway in this thread: http://archives.postgresql.org/pgsql-hackers/2004-02/msg00229.php A new string variable 'custom_variable_classes' is introduced. This variable is a comma separated string of identifiers. Each identifier denots a 'class' that will allow its members to be added without error. This variable must be defined in postmaster.conf. The lexer (guc_file.l) is changed so that it can accept a qualified name in the form <ID>.<ID> as the name of a variable. I also changed so that the 'custom_variable_classes', if found, is added first of all variables in order to remove the order of declaration issue. The guc_variables table is made more dynamic. It is originally created with 20% slack and can grow dynamically. A capacity is introduced to avoid resizing every time a new variable is added. guc_variables and num_guc_variables becomes static (hidden). The GucInfoMain now uses the new function get_guc_variables() and GetNumConfigOptions instead or using the guc_variables directly. The find_option() function, when passed a missing name, will check if the name is qualified. If the name is qualified and if the qualifier denotes a class included in the 'custom_variable_classes', a placeholder variable will be created. Such a placeholder will not participate in a list operation but will otherwise function as a normal string variable. Define<type>GucVariable() functions will be added, one for each variable type. They are inteded to be used by add-on modules like the pl<lang> mappings. Example: extern void DefineCustomBoolVariable( const char* name, const char* short_desc, const char* long_desc, bool* valueAddr, GucContext context, GucBoolAssignHook assign_hook, GucShowHook show_hook); (I created typedefs for the assign-hook and show-hook functions). A call to these functions will define a new GUC-variable. If a placeholder exists it will be replaced but it's value will be used in place of the default value. The valueAddr is assumed ot point at a default value when the define function is called. The only constraint that is imposed on a Custom variable is that its name is qualified. Finally, a function: void EmittWarningsOnPlacholders(const char* className) was added. This function should be called when a module has completed its variable definitions. At that time, no placeholders should remain for the class that the module uses. If they do, elog(INFO, ...) messages will be issued to inform the user that unrecognized variables are present. Thomas Hallgren
* This patch implement the TODO [ALTER DATABASE foo OWNER TO bar].Bruce Momjian2004-05-261-2/+13
| | | | | | | | | | It was necessary to touch in grammar and create a new node to make home to the new syntax. The command is also supported in E CPG. Doc updates are attached too. Only superusers can change the owner of the database. New owners don't need any aditional privileges. Euler Taveira de Oliveira
* Reimplement the linked list data structure used throughout the backend.Neil Conway2004-05-2611-364/+345
| | | | | | | | | | | | | | | | In the past, we used a 'Lispy' linked list implementation: a "list" was merely a pointer to the head node of the list. The problem with that design is that it makes lappend() and length() linear time. This patch fixes that problem (and others) by maintaining a count of the list length and a pointer to the tail node along with each head node pointer. A "list" is now a pointer to a structure containing some meta-data about the list; the head and tail pointers in that structure refer to ListCell structures that maintain the actual linked list of nodes. The function names of the list API have also been changed to, I hope, be more logically consistent. By default, the old function names are still available; they will be disabled-by-default once the rest of the tree has been updated to use the new API names.
* Still another place to make the world safe for zero-column tables:Tom Lane2004-05-232-26/+30
| | | | | remove the ancient (and always pretty dodgy) assumption in parse_clause.c that a query can't have an empty targetlist.
* Promote row expressions to full-fledged citizens of the expression syntax,Tom Lane2004-05-104-336/+553
| | | | | | | | | | rather than allowing them only in a few special cases as before. In particular you can now pass a ROW() construct to a function that accepts a rowtype parameter. Internal generation of RowExprs fixes a number of corner cases that used to not work very well, such as referencing the whole-row result of a JOIN or subquery. This represents a further step in the work I started a month or so back to make rowtype values into first-class citizens.
* ALTER TABLE rewrite. New cool stuff:Tom Lane2004-05-052-332/+286
| | | | | | | | | | | | | | | | | | | | * ALTER ... ADD COLUMN with defaults and NOT NULL constraints works per SQL spec. A default is implemented by rewriting the table with the new value stored in each row. * ALTER COLUMN TYPE. You can change a column's datatype to anything you want, so long as you can specify how to convert the old value. Rewrites the table. (Possible future improvement: optimize no-op conversions such as varchar(N) to varchar(N+1).) * Multiple ALTER actions in a single ALTER TABLE command. You can perform any number of column additions, type changes, and constraint additions with only one pass over the table contents. Basic documentation provided in ALTER TABLE ref page, but some more docs work is needed. Original patch from Rod Taylor, additional work from Tom Lane.
* Change COPY CSV keyword to be:Bruce Momjian2004-04-212-9/+7
| | | | | FORCE QUOTE to force quotes FORCE NOT NULL to quote null input values
* Complete TODO item:Bruce Momjian2004-04-192-4/+32
| | | | | | | | | | | | | | o -Allow dump/load of CSV format This adds new keywords to COPY and \copy: CSV - enable CSV mode (comma separated variable) QUOTE - specify quote character ESCAPE - specify escape character FORCE - force quoting of specified column LITERAL - suppress null comparison for columns Doc changes included. Regression updates coming from Andrew.
* Tweak findTargetlistEntry so that bare names occurring in GROUP BY clausesTom Lane2004-04-183-10/+19
| | | | | | | | are sought first as local FROM columns, then as local SELECT-list aliases, and finally as outer FROM columns; the former behavior made outer FROM columns take precedence over aliases. This does not change spec conformance because SQL99 allows only the first case anyway, and it seems more useful and self-consistent. Per gripe from Dennis Bjorklund 2004-04-05.
* Allow LIKE/ILIKE to appear in more places in a query.Bruce Momjian2004-04-051-7/+24
| | | | Fabien COELHO
* Fix poor choice of error message in corner cases.Tom Lane2004-04-021-2/+3
|
* Clean up some code that had gotten a bit ugly through repeated revisions.Tom Lane2004-04-021-13/+10
|
* Get rid of crocky use of RangeVar nodes in parser to represent partiallyTom Lane2004-04-024-271/+220
| | | | transformed whole-row variables. Cleaner to use regular whole-row Vars.
* Replace TupleTableSlot convention for whole-row variables and functionTom Lane2004-04-011-6/+6
| | | | | | | | results with tuples as ordinary varlena Datums. This commit does not in itself do much for us, except eliminate the horrid memory leak associated with evaluation of whole-row variables. However, it lays the groundwork for allowing composite types as table columns, and perhaps some other useful features as well. Per my proposal of a few days ago.
* Replace max_expr_depth parameter with a max_stack_depth parameter thatTom Lane2004-03-242-35/+4
| | | | | | is measured in kilobytes and checked against actual physical execution stack depth, as per my proposal of 30-Dec. This gives us a fairly bulletproof defense against crashing due to runaway recursive functions.
* Revise syntax-error reporting behavior to give pleasant results forTom Lane2004-03-211-1/+7
| | | | | errors in internally-generated queries, such as those submitted by plpgsql functions. Per recent discussions with Fabien Coelho.
* Reimplement CASE val WHEN compval1 THEN ... WHEN compval2 THEN ... ENDTom Lane2004-03-172-25/+40
| | | | | | | | so that the 'val' is computed only once, per recent discussion. The speedup is not much when 'val' is just a simple variable, but could be significant for larger expressions. More importantly this avoids issues with multiple evaluations of a volatile 'val', and it allows the CASE expression to be reverse-listed in its original form by ruleutils.c.
* Remove grotty special-case code in coerce_to_target_type() thatTom Lane2004-03-151-45/+1
| | | | | | | implemented casts to varchar and bpchar using a cast-to-text function. This is a holdover from before we had pg_cast; it now makes more sense to just list these casts in pg_cast. While at it, add pg_cast entries for the other direction (casts from varchar/bpchar) where feasible.
* Add NOWAIT option to LOCK commandTatsuo Ishii2004-03-112-4/+12
|
* Add ALSO keyword to CREATE RULE.Bruce Momjian2004-03-092-3/+5
| | | | Fabien COELHO
* Implement dollar-quoting in the backend lexer and psql. DocumentationTom Lane2004-02-241-3/+57
| | | | | | | is still lacking, as is support in plpgsql and other places, but this is the basic feature. Patch by Andrew Dunstan, some tweaking by Tom Lane. Also, enable %option nodefault in these two lexers, and patch some gaps revealed thereby.
* Implement a solution to the 'Turkish locale downcases I incorrectly'Tom Lane2004-02-213-45/+87
| | | | | | problem, per previous discussion. Make some additional changes to centralize the knowledge of just how identifier downcasing is done, in hopes of simplifying any future tweaking in this area.
* Cosmetic changes (mostly whitespace) to make it easier to diff theTom Lane2004-02-191-51/+58
| | | | backend lexer against psql's.
* Try to make 'cross-database references are not implemented' errors aTom Lane2004-02-132-4/+6
| | | | | bit more helpful by identifying the specific qualified name being complained of.
* Fix oversight in check_ungrouped_columns optimization that avoidsTom Lane2004-01-281-7/+18
| | | | | | | unnecessary checks for complex grouping expressions: we cannot check whether the expressions are simple Vars until after we apply flatten_join_alias_vars, because in the case of FULL JOIN that routine can introduce non-Var expressions. Per example from Joel Knight.
* Fix a minor bug introduced by the recent CREATE TABLE AS / WITH OIDSNeil Conway2004-01-232-19/+33
| | | | | | patch: a 3-value enum was mistakenly assigned directly to a 'bool' in transformCreateStmt(). Along the way, change makeObjectName() to be static, as it isn't used outside analyze.c
* Fix permission-checking bug reported by Tim Burgess 10-Feb-03 (this timeTom Lane2004-01-143-43/+47
| | | | | | | | | for sure...). Rather than relying on the query context of a rangetable entry to identify what permissions it wants checked, store a full AclMode mask in each RTE, and check exactly those bits. This allows an RTE specifying, say, INSERT privilege on a view to be copied into a derived UPDATE query without changing meaning. Per recent discussion thread. initdb forced due to change of stored rule representation.
* Add CREATE TRIGGER, CREATE INDEX, and CREATE SEQUENCE to the list ofNeil Conway2004-01-112-23/+61
| | | | | | | expressions supported by CREATE SCHEMA. Also added the beginning of some regression tests for CREATE SCHEMA; plenty more work is needed here.
* Implement "WITH / WITHOID OIDS" clause for CREATE TABLE AS. This isNeil Conway2004-01-102-14/+40
| | | | | | | | | | intended to allow application authors to insulate themselves from changes to the default value of 'default_with_oids' in future releases of PostgreSQL. This patch also fixes a bug in the earlier implementation of the 'default_with_oids' GUC variable: code in gram.y should not examine the value of GUC variables directly due to synchronization issues.
* Allow BEGIN WORK to specify transaction isolation level, like STARTBruce Momjian2004-01-101-3/+3
| | | | TRANSACTION.
* More janitorial work: remove the explicit casting of NULL literals to aNeil Conway2004-01-072-13/+13
| | | | | | | | 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.
* Apply the core parts of Dennis Bjorklund's patch to allow functionTom Lane2004-01-061-23/+64
| | | | | | | | | 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.