aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
Commit message (Collapse)AuthorAge
* Code review for domain-constraints patch. Use a new ConstraintTest nodeTom Lane2002-08-31
| | | | | | | | | type for runtime constraint checks, instead of misusing the parse-time Constraint node for the purpose. Fix some damage introduced into type coercion logic; in particular ensure that a coerced expression tree will read out the correct result type when inspected (patch had broken some RelabelType cases). Enforce domain NOT NULL constraints against columns that are omitted from an INSERT.
* Fix ruleutils to dump column definition lists for anonymous record typesTom Lane2002-08-29
| | | | defined in the FROM clause. From Joe Conway, with some tweaks.
* Modify array operations to include array's element type OID in theTom Lane2002-08-26
| | | | | | | | | | array header, and to compute sizing and alignment of array elements the same way normal tuple access operations do --- viz, using the tupmacs.h macros att_addlength and att_align. This makes the world safe for arrays of cstrings or intervals, and should make it much easier to write array-type-polymorphic functions; as examples see the cleanups of array_out and contrib/array_iterator. By Joe Conway and Tom Lane.
* Make pg_dump output more portable and more pleasing to look at.Peter Eisentraut2002-08-18
| | | | | | | | | | | | | | | | | The -n and -N options were removed. Quoting is now smart enough to supply quotes if and only if necessary. Numerical types are now printed without quotes, except in cases of special values such as NaN. Boolean values printed as true and false. Most string literals now do not escape whitespace characters (newlines, etc.) for portability. SET SESSION AUTHORIZATION argument is a string literal, to follow SQL. Made commands output by pg_dump use consistent spacing and indentation.
* Modify pg_dump to dump foreign-key constraints as constraints, not asTom Lane2002-08-16
| | | | | | | sets of triggers. Also modify psql \d command to show foreign key constraints as such and hide the triggers. pg_get_constraintdef() function added to backend to support these. From Rod Taylor, code review and some editorialization by Tom Lane.
* Make domain types indexable. Rod Taylor & Tom Lane.Tom Lane2002-08-16
|
* Cause view/rule display to work as expected after rename of an underlyingTom Lane2002-08-08
| | | | table or column, or of an output column of the view itself.
* Cause schema-qualified FROM items and schema-qualified variable referencesTom Lane2002-08-08
| | | | | | to behave according to SQL92 (or according to my current understanding of same, anyway). Per pghackers discussion way back in March 2002: thread 'Do FROM items of different schemas conflict?'
* pg_cast table, and standards-compliant CREATE/DROP CAST commands, plusPeter Eisentraut2002-07-18
| | | | | | | | | | | extension to create binary compatible casts. Includes dependency tracking as well. pg_proc.proimplicit is now defunct, but will be removed in a separate commit. pg_dump provides a migration path from the previous scheme to declare casts. Dumping binary compatible casts is currently impossible, though.
* Back out BETWEEN node patch, was causing initdb failure.Bruce Momjian2002-07-18
|
* Finished the Between patch Christopher started.Bruce Momjian2002-07-18
| | | | | | | | | | | | Implements between (symmetric / asymmetric) as a node. Executes the left or right expression once, makes a Const out of the resulting Datum and executes the >=, <= portions out of the Const sets. Of course, the parser does a fair amount of preparatory work for this to happen. Rod Taylor
* Implement the IS DISTINCT FROM operator per SQL99.Thomas G. Lockhart2002-07-04
| | | | | | | | | | | | | | | | Reused the Expr node to hold DISTINCT which strongly resembles the existing OP info. Define DISTINCT_EXPR which strongly resembles the existing OPER_EXPR opType, but with handling for NULLs required by SQL99. We have explicit support for single-element DISTINCT comparisons all the way through to the executor. But, multi-element DISTINCTs are handled by expanding into a comparison tree in gram.y as is done for other row comparisons. Per discussions, it might be desirable to move this into one or more purpose-built nodes to be handled in the backend. Define the optional ROW keyword and token per SQL99. This allows single-element row constructs, which were formerly disallowed due to shift/reduce conflicts with parenthesized a_expr clauses. Define the SQL99 TREAT() function. Currently, use as a synonym for CAST().
* Further tweaks to support display of sort keys in EXPLAIN --- initialTom Lane2002-06-13
| | | | implementation didn't work for Sort nodes associated with Append plans.
* Queries used by ruleutils were not schema-proof.Tom Lane2002-05-28
|
* Add display of sort keys to the default EXPLAIN output.Tom Lane2002-05-18
|
* Merge the last few variable.c configuration variables into the genericTom Lane2002-05-17
| | | | | | | | | GUC support. It's now possible to set datestyle, timezone, and client_encoding from postgresql.conf and per-database or per-user settings. Also, implement rollback of SET commands that occur in a transaction that later fails. Create a SET LOCAL var = value syntax that sets the variable only for the duration of the current transaction. All per previous discussions in pghackers.
* Get rid of long-since-vestigial Iter node type, in favor of adding aTom Lane2002-05-12
| | | | | | | returns-set boolean field in Func and Oper nodes. This allows cleaner, more reliable tests for expressions returning sets in the planner and parser. For example, a WHERE clause returning a set is now detected and complained of in the parser, not only at runtime.
* First pass at set-returning-functions in FROM, by Joe Conway withTom Lane2002-05-12
| | | | | | some kibitzing from Tom Lane. Not everything works yet, and there's no documentation or regression test, but let's commit this so Joe doesn't need to cope with tracking changes in so many files ...
* Make ruleutils.c schema-aware. Displayed names are schema-qualifiedTom Lane2002-05-03
| | | | | only if they would not be found without qualification given the current search path, as per idea from Peter Eisentraut.
* Tweak scanner/grammar interface so that the keyword-as-identifier rulesTom Lane2002-05-02
| | | | | | in gram.y can make use of the keywords.c string table, instead of having their own copies of the keyword strings. This saves a few kilobytes and more importantly eliminates an opportunity for cut-and-paste errors.
* Make ruleutils.c use format_type for printing typenames. Minor tweaksTom Lane2002-04-28
| | | | in quoting rules and recognition of implicit type coercions.
* Implement types regprocedure, regoper, regoperator, regclass, regtypeTom Lane2002-04-25
| | | | | | | per pghackers discussion. Add some more typsanity tests, and clean up some problems exposed thereby (broken or missing array types for some built-in types). Also, clean up loose ends from unknownin/out patch.
* Change naming rule for ON SELECT rules of views: they're all justTom Lane2002-04-19
| | | | _RETURN now, since there's no need to keep 'em unique anymore.
* Rule names are now unique per-relation, rather than unique globally.Tom Lane2002-04-18
| | | | | | | | DROP RULE and COMMENT ON RULE syntax adds an 'ON tablename' clause, similar to TRIGGER syntaxes. To allow loading of existing pg_dump files containing COMMENT ON RULE, the COMMENT code will still accept the old syntax --- but only if the target rulename is unique across the whole database.
* Restructure representation of aggregate functions so that they have pg_procTom Lane2002-04-11
| | | | | | | | | | entries, per pghackers discussion. This fixes aggregates to live in namespaces, and also simplifies/speeds up lookup in parse_func.c. Also, add a 'proimplicit' flag to pg_proc that controls whether a type coercion function may be invoked implicitly, or only explicitly. The current settings of these flags are more permissive than I would like, but we will need to debate and refine the behavior; for now, I avoided breaking regression tests as much as I could.
* A little further progress on schemas: push down RangeVars intoTom Lane2002-03-22
| | | | | | | addRangeTableEntry calls. Remove relname field from RTEs, since it will no longer be a useful unique identifier of relations; we want to encourage people to rely on the relation OID instead. Further work on dumping qual expressions in EXPLAIN, too.
* First phase of SCHEMA changes, concentrating on fixing the grammar andTom Lane2002-03-21
| | | | | | | | the parsetree representation. As yet we don't *do* anything with schema names, just drop 'em on the floor; but you can enter schema-compatible command syntax, and there's even a primitive CREATE SCHEMA command. No doc updates yet, except to note that you can now extract a field from a function-returning-row's result with (foo(...)).fieldname.
* Restructure representation of join alias variables. An explicit JOINTom Lane2002-03-12
| | | | | | | | | | | | | | | now has an RTE of its own, and references to its outputs now are Vars referencing the JOIN RTE, rather than CASE-expressions. This allows reverse-listing in ruleutils.c to use the correct alias easily, rather than painfully reverse-engineering the alias namespace as it used to do. Also, nested FULL JOINs work correctly, because the result of the inner joins are simple Vars that the planner can cope with. This fixes a bug reported a couple times now, notably by Tatsuo on 18-Nov-01. The alias Vars are expanded into COALESCE expressions where needed at the very end of planning, rather than during parsing. Also, beginnings of support for showing plan qualifier expressions in EXPLAIN. There are probably still cases that need work. initdb forced due to change of stored-rule representation.
* Modify ALTER TABLE OWNER to change index ownership; code cleanup.Bruce Momjian2002-03-06
| | | | Neil Conway
* Change made to elog:Bruce Momjian2002-03-06
| | | | | | | | | | | | | | | | | | | o Change all current CVS messages of NOTICE to WARNING. We were going to do this just before 7.3 beta but it has to be done now, as you will see below. o Change current INFO messages that should be controlled by client_min_messages to NOTICE. o Force remaining INFO messages, like from EXPLAIN, VACUUM VERBOSE, etc. to always go to the client. o Remove INFO from the client_min_messages options and add NOTICE. Seems we do need three non-ERROR elog levels to handle the various behaviors we need for these messages. Regression passed.
* A bunch of changes aimed at reducing backend startup time...Tom Lane2002-02-19
| | | | | | | | | | | | | | | | | | | | | | | | | | Improve 'pg_internal.init' relcache entry preload mechanism so that it is safe to use for all system catalogs, and arrange to preload a realistic set of system-catalog entries instead of only the three nailed-in-cache indexes that were formerly loaded this way. Fix mechanism for deleting out-of-date pg_internal.init files: this must be synchronized with transaction commit, not just done at random times within transactions. Drive it off relcache invalidation mechanism so that no special-case tests are needed. Cache additional information in relcache entries for indexes (their pg_index tuples and index-operator OIDs) to eliminate repeated lookups. Also cache index opclass info at the per-opclass level to avoid repeated lookups during relcache load. Generalize 'systable scan' utilities originally developed by Hiroshi, move them into genam.c, use in a number of places where there was formerly ugly code for choosing either heap or index scan. In particular this allows simplification of the logic that prevents infinite recursion between syscache and relcache during startup: we can easily switch to heapscans in relcache.c when and where needed to avoid recursion, so IndexScanOK becomes simpler and does not need any expensive initialization. Eliminate useless opening of a heapscan data structure while doing an indexscan (this saves an mdnblocks call and thus at least one kernel call).
* Change display of FieldSelect nodes from arg.field to field(arg),Tom Lane2001-11-26
| | | | | | | per bug report from Stefan Hadjistoytchev. There are some cases where the dot notation works, but there are more where it doesn't. Eventually ought to consider fixing the parser to allow cases like func().field, but for now this is the simplest patch.
* Repair problem with listing rules that have a WHERE condition andTom Lane2001-11-26
| | | | | have an INSERT...SELECT as the first or only action. Per bug report from Sergio Pili.
* Tweak format_type so that we get good behavior for both column typeTom Lane2001-11-19
| | | | | display (with a typemod) and function arg/result type display (without a typemod).
* pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian2001-10-25
| | | | tests pass.
* Fix ruleutils to depend on format_type, rather than having a privateTom Lane2001-10-08
| | | | | copy of code that knows about displaying types with typmod info. Needed so that it does the right thing with timestamp datatypes now.
* Ooops, I was a little too enthusiastic about suppressing defaultTom Lane2001-10-04
| | | | | index opclasses; they might be default for some other datatype, in which case we mustn't suppress 'em.
* Extend pg_get_indexdef() to know about index predicates. Also, tweakTom Lane2001-10-01
| | | | | | | | it to suppress index opclass output for opclasses that are the default for their datatype; only non-default opclasses are shown explicitly. This is expected to improve portability of the CREATE INDEX command across future versions of Postgres --- we've changed index opclasses too often in the past to think we won't do so again.
* Make ALTER TABLE RENAME on a view rename the view's on-select rule too.Tom Lane2001-08-12
| | | | Needed to keep pg_dump from getting confused.
* Fix optimizer to not try to push WHERE clauses down into a sub-SELECT thatTom Lane2001-07-31
| | | | | | has a DISTINCT ON clause, per bug report from Anthony Wood. While at it, improve the DISTINCT-ON-clause recognizer routine to not be fooled by out- of-order DISTINCT lists.
* Partial indexes work again, courtesy of Martijn van Oosterhout.Tom Lane2001-07-16
| | | | | | Note: I didn't force an initdb, figuring that one today was enough. However, there is a new function in pg_proc.h, and pg_dump won't be able to dump partial indexes until you add that function.
* Remove unnecessarily enthusiastic parenthesizing in reverse-listing ofTom Lane2001-07-10
| | | | IS NULL, IS TRUE, and friends (my fault...)
* Add IS UNKNOWN, IS NOT UNKNOWN boolean tests, fix the existing booleanTom Lane2001-06-19
| | | | | | | tests to return the correct results per SQL9x when given NULL inputs. Reimplement these tests as well as IS [NOT] NULL to have their own expression node types, instead of depending on special functions. From Joe Conway, with a little help from Tom Lane.
* Make rule lister do the right thing with Vars representing whole tuples.Tom Lane2001-04-18
|
* Constant expressions that appear in ORDER BY, GROUP BY, DISTINCT ONTom Lane2001-04-15
| | | | | | | | lists should be reverse-compiled into targetlist index numbers, because that's the only interpretation the parser allows for a constant in these clauses. (Ergo, the only way they could have gotten into the list in the first place is to have come from the targetlist; so this should always work.) Per problem report from Peter E.
* Remove dashes in comments that don't need them, rewrap with pgindent.Bruce Momjian2001-03-22
|
* pgindent run. Make it all clean.Bruce Momjian2001-03-22
|
* Change case-folding of keywords to conform to SQL99 and fix misbehaviorTom Lane2001-02-21
| | | | | | | in Turkish locale. Keywords are now checked under pure ASCII case-folding rules ('A'-'Z'->'a'-'z' and nothing else). However, once a word is determined not to be a keyword, it will be case-folded under the current locale, same as before. See pghackers discussion 20-Feb-01.
* Change scoping of table and join refnames to conform to SQL92: a JOINTom Lane2001-02-14
| | | | | | | | | clause with an alias is a <subquery> and therefore hides table references appearing within it, according to the spec. This is the same as the preliminary patch I posted to pgsql-patches yesterday, plus some really grotty code in ruleutils.c to reverse-list a query tree with the correct alias name depending on context. I'd rather not have done that, but unless we want to force another initdb for 7.1, there's no other way for now.
* Fix breakage of rules using NOTIFY actions, per bug report and patchTom Lane2001-01-03
| | | | from sergiop@sinectis.com.ar.