aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
Commit message (Collapse)AuthorAge
* Give a more reasonable error message for a bad attribute name appliedTom Lane2001-03-14
| | | | to a join or subselect alias ... cf. Oliver Elphick's complaint 13-Mar.
* Fix vacuum analyze error.Tatsuo Ishii2001-02-27
| | | | | | | | | | | | | | | | | | vacuum analyze on pg_type fails if bogus entries remain in pg_operator. Here is a sample script to reproduce the problem. drop table t1; create table t1(i int); drop function foo(t1,t1); create function foo(t1,t1) returns bool as 'select true' language 'sql'; create operator = ( leftarg = t1, rightarg = t1, commutator = =, procedure = foo ); drop table t1; vacuum analyze;
* 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.
* Allow extract() to accept the same field selectors as date_part(), not justPeter Eisentraut2001-02-18
| | | | the ones specified by SQL.
* Clean up two rather nasty bugs in operator selection code.Tom Lane2001-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. If there is exactly one pg_operator entry of the right name and oprkind, oper() and related routines would return that entry whether its input type had anything to do with the request or not. This is just premature optimization: we shouldn't return the single candidate until after we verify that it really is a valid candidate, ie, is at least coercion-compatible with the given types. 2. oper() and related routines only promise a coercion-compatible result. Unfortunately, there were quite a few callers that assumed the returned operator is binary-compatible with the given datatype; they would proceed to call it without making any datatype coercions. These callers include sorting, grouping, aggregation, and VACUUM ANALYZE. In general I think it is appropriate for these callers to require an exact or binary-compatible match, so I've added a new routine compatible_oper() that only succeeds if it can find an operator that doesn't require any run-time conversions. Callers now call oper() or compatible_oper() depending on whether they are prepared to deal with type conversion or not. The upshot of these bugs is revealed by the following silliness in PL/Tcl's selftest: it creates an operator @< on int4, and then tries to use it to sort a char(N) column. The system would let it do that :-( (and evidently has done so since 6.3 :-( :-(). The result in this case was just a silly sort order, but the reverse combination would've provoked coredump from trying to dereference integers. With this fix you get more reasonable behavior: pltcl_test=# select * from T_pkey1 order by key1, key2 using @<; ERROR: Unable to identify an operator '@<' for types 'bpchar' and 'bpchar' You will have to retype this query using an explicit cast
* Arrange for ORDER BY an expression on a UNION/INTERSECT/EXCEPT result,Tom Lane2001-02-15
| | | | | | | | | | such as SELECT f1 FROM foo UNION SELECT ... ORDER BY upper(f1) to draw 'ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of the result columns' rather than the uninformative 'f1 not found' we were producing before. Eventually this should actually work, but that looks much too hard to try to implement in late beta...
* Repair problems with duplicate index names generated when CREATE TABLETom Lane2001-02-14
| | | | specifies redundant UNIQUE conditions.
* 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.
* Only look for bison as YACC; other yaccs need to be selected explicitly.Peter Eisentraut2001-02-10
| | | | | When no suitable YACC is configured, supply useful informational messages to users. (Same way flex has been handled for a while.)
* plpgsql's private copy of xlateSqlType was out of sync. Again. ThisTom Lane2001-02-09
| | | | | is clearly not maintainable, so dike it out in favor of calling the real version in the backend's gram.y.
* Use elog() instead of exit() for fatal scanner errors.Peter Eisentraut2001-02-03
|
* Fix failure to create sequences for more than one SERIAL column in aTom Lane2001-01-27
| | | | table.
* Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian2001-01-24
|
* Give 'a_expr ::= a_expr Op' production a slightly lower precedence thanTom Lane2001-01-23
| | | | | | | | | | Op, so that the sequence 'a_expr Op Op a_expr' will be parsed as a_expr Op (Op a_expr) not (a_expr Op) Op a_expr as formerly. In other words, prefer treating user-defined operators as prefix operators to treating them as postfix operators, when there is an ambiguity. Also clean up a couple of other infelicities in production priority assignment --- for example, BETWEEN wasn't being given the intended priority, but that of AND.
* Remove no-longer-needed restriction against referencing systemTom Lane2001-01-23
| | | | | | attributes in a FieldSelect node --- all the places that manipulate these work just fine with system attribute numbers. OK, it's a new feature, so shoot me ...
* Give a good error message for what's likely to be a common syntax error,Tom Lane2001-01-20
| | | | namely omitting the alias clause for a sub-SELECT in FROM.
* Suppress unused-variable warning in non-Assert compilations.Tom Lane2001-01-19
|
* Change lcons(x, NIL) to makeList(x) where appropriate.Bruce Momjian2001-01-17
|
* Fix problems with parentheses around sub-SELECT --- for the last time,Tom Lane2001-01-15
| | | | | | | | | | | | | I hope. I finally realized that we were going at it backwards: when there are excess parentheses, they need to be treated as part of the sub-SELECT, not as part of the surrounding expression. Although either choice yields an unambiguous grammar, only this way produces a grammar that is LALR(1). With the old approach we were guaranteed to fail on either 'SELECT (((SELECT 2)) + 3)' or 'SELECT (((SELECT 2)) UNION SELECT 2)' depending on which way we resolve the initial shift/reduce conflict. With the new way, the same reduction track can be followed in both cases until we have advanced far enough to know whether we are done with the sub-SELECT or not.
* Remove compiler warning about uninitialized warnings.Bruce Momjian2001-01-08
|
* Simplify the rules that explicitly allowed TYPE as a type name (which isPeter Eisentraut2001-01-06
| | | | | no longer the case). Add AND and TRAILING to ColLabel. All key words except AS are now at least ColLabel's.
* Remove not-really-standard implementation of CREATE TABLE's UNDER clause,Tom Lane2001-01-05
| | | | | | | | | | | and revert documentation to describe the existing INHERITS clause instead, per recent discussion in pghackers. Also fix implementation of SQL_inheritance SET variable: it is not cool to look at this var during the initial parsing phase, only during parse_analyze(). See recent bug report concerning misinterpretation of date constants just after a SET TIMEZONE command. gram.y really has to be an invariant transformation of the query string to a raw parsetree; anything that can vary with time must be done during parse analysis.
* Fix portability problems recently exposed by regression tests on Alphas.Tom Lane2000-12-27
| | | | | | | | | | 1. Distinguish cases where a Datum representing a tuple datatype is an OID from cases where it is a pointer to TupleTableSlot, and make sure we use the right typlen in each case. 2. Make fetchatt() and related code support 8-byte by-value datatypes on machines where Datum is 8 bytes. Centralize knowledge of the available by-value datatype sizes in two macros in tupmacs.h, so that this will be easier if we ever have to do it again.
* Clean up CREATE TYPE/OPERATOR/AGGREGATE productions, so that parserTom Lane2000-12-22
| | | | will not accept types named with operator names or vice versa.
* Repair mishandling of PRIMARY KEY declaration that references anTom Lane2000-12-18
| | | | inherited column, per bug report from Elphick 12/15/00.
* Tweak select_common_type() to deal with possibility of multiple preferredTom Lane2000-12-17
| | | | | types in a category --- it was taking the last preferred type among the inputs, rather than the first one as intended.
* Remove current->old mapping.Bruce Momjian2000-12-15
|
* Make algorithm for resolving UNKNOWN function/operator inputs beTom Lane2000-12-15
| | | | insensitive to the order of arguments. Per pghackers discussion 12/10/00.
* Remove obsolete comment.Tom Lane2000-12-15
|
* transformForUpdate() mustn't assume rowMarks list is initially empty.Tom Lane2000-12-07
| | | | | It could be recursing into a sub-query where there was already a FOR UPDATE clause.
* Clean up handling of FOR UPDATE inside views and subselects ... make itTom Lane2000-12-06
| | | | | | | work where we can (given that the executor only handles it at top level) and generate an error where we can't. Note that while the parser has been allowing views to say SELECT FOR UPDATE for a few weeks now, that hasn't actually worked until just now.
* From Stephan Szabo:Tom Lane2000-12-05
| | | | | | | | | | I believe this should fix the issue that Philip Warner noticed about the check for unique constraints meeting the referenced keys of a foreign key constraint allowing the specification of a subset of a foreign key instead of rejecting it. I also added tests for a base case of this to the foreign key and alter table tests and patches for expected output.
* Repair breakage of rules containing INSERT ... SELECT actions, per bugTom Lane2000-12-05
| | | | | | | | | | | report from Joel Burton. Turns out that my simple idea of turning the SELECT into a subquery does not interact well *at all* with the way the rule rewriter works. Really what we need to make INSERT ... SELECT work cleanly is to decouple targetlists from rangetables: an INSERT ... SELECT wants to have two levels of targetlist but only one rangetable. No time for that for 7.1, however, so I've inserted some ugly hacks to make the rewriter know explicitly about the structure of INSERT ... SELECT queries. Ugh :-(
* Ensure that all uses of <ctype.h> functions are applied to unsigned-charTom Lane2000-12-03
| | | | | values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00.
* Repair usage of the OVERLAPS operator.Thomas G. Lockhart2000-12-03
| | | | | | | | Allow some operator-like tokens to be used as function names. Flesh out support for time, timetz, and interval operators and interactions. Regression tests pass, but non-reference-platform horology test results will need to be updated.
* Make SET SESSION CHARACTERISTICS compliant with SQL 99. Remove redundant,Peter Eisentraut2000-11-24
| | | | | non-standard clauses. Allow CHARACTERISTICS as unquoted identifier. Merge related reference pages.
* Treat plain 'BIT' as 'BIT(1)'.Peter Eisentraut2000-11-18
|
* Add separate type category for bit string types, allowing mixed bit/varbitPeter Eisentraut2000-11-17
| | | | function calls to work.
* Make a pstrdup copy of the literalbuf when scanning a bit string. Other-Peter Eisentraut2000-11-16
| | | | wise the next bit string in the same command clobbers the previous ones.
* Change SearchSysCache coding conventions so that a reference count isTom Lane2000-11-16
| | | | | | | maintained for each cache entry. A cache entry will not be freed until the matching ReleaseSysCache call has been executed. This eliminates worries about cache entries getting dropped while still in use. See my posting to pg-hackers of even date for more info.
* Add support for casting bit string constants.Peter Eisentraut2000-11-16
|
* Extend CREATE DATABASE to allow selection of a template database to beTom Lane2000-11-14
| | | | | | | | | | cloned, rather than always cloning template1. Modify initdb to generate two identical databases rather than one, template0 and template1. Connections to template0 are disallowed, so that it will always remain in its virgin as-initdb'd state. pg_dumpall now dumps databases with restore commands that say CREATE DATABASE foo WITH TEMPLATE = template0. This allows proper behavior when there is user-added data in template1. initdb forced!
* Restructure handling of inheritance queries so that they work with outerTom Lane2000-11-12
| | | | | | | | | | | | | | | | | joins, and clean things up a good deal at the same time. Append plan node no longer hacks on rangetable at runtime --- instead, all child tables are given their own RT entries during planning. Concept of multiple target tables pushed up into execMain, replacing bug-prone implementation within nodeAppend. Planner now supports generating Append plans for inheritance sets either at the top of the plan (the old way) or at the bottom. Expanding at the bottom is appropriate for tables used as sources, since they may appear inside an outer join; but we must still expand at the top when the target of an UPDATE or DELETE is an inheritance set, because we actually need a different targetlist and junkfilter for each target table in that case. Fortunately a target table can't be inside an outer join... Bizarre mutual recursion between union_planner and prepunion.c is gone --- in fact, union_planner doesn't really have much to do with union queries anymore, so I renamed it grouping_planner.
* Fix bug in recent improvement to type resolution code. Forgot to retainThomas G. Lockhart2000-11-11
| | | | | "best choice" type category when resolving UNKNOWN function and operator arguments. Thanks to Tom Lane for finding test case.
* Arrange for CASE or UNION with only untyped literal constants as inputTom Lane2000-11-09
| | | | to resolve the unknown constants as type TEXT.
* Make DROP TABLE rollback-able: postpone physical file delete until commit.Tom Lane2000-11-08
| | | | | | | | | (WAL logging for this is not done yet, however.) Clean up a number of really crufty things that are no longer needed now that DROP behaves nicely. Make temp table mapper do the right things when drop or rename affecting a temp table is rolled back. Also, remove "relation modified while in use" error check, in favor of locking tables at first reference and holding that lock throughout the statement.
* Add ANALYSE spelling of ANALYZE for vacuum.Bruce Momjian2000-11-08
|
* Enable fallback to string type when argument(s) are of UNKNOWN type.Thomas G. Lockhart2000-11-07
| | | | | | | Same code exactly as for function resolution. An obvious example is for select '1' = '01'; which used to throw an error and which now resolves to two text strings.
* Implement AT TIME ZONE SQL9x syntax.Thomas G. Lockhart2000-11-06
| | | | AT is now a keyword but is not a reserved word.
* Allow type resolution for UNKNOWN arguments to functions to fall back toThomas G. Lockhart2000-11-06
| | | | | | | any available string type. Previously, all candidate choices must have fallen within the same "type category" for PostgreSQL to be willing to choose any of them. Need to apply the same fixup to operator type resolution.