aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_clause.c
Commit message (Collapse)AuthorAge
...
* Tweak GROUP BY so that it will still accept result-column names, but onlyTom Lane2000-03-15
| | | | | | | | | | after trying to resolve the item as an input-column name. This allows us to be compliant with the SQL92 spec for queries that fall within the spec, while still accepting the same out-of-spec queries as 6.5 did. You'll only lose if there is an output column name that is the same as an input column name, but doesn't refer to the same value. 7.0 will interpret such a GROUP BY spec differently than 6.5 did. No way around that, because 6.5 was clearly not spec compliant.
* Implement column aliases on views "CREATE VIEW name (collist)".Thomas G. Lockhart2000-03-14
| | | | | | | | | | | | | | | | | | Implement TIME WITH TIME ZONE type (timetz internal type). Remap length() for character strings to CHAR_LENGTH() for SQL92 and to remove the ambiguity with geometric length() functions. Keep length() for character strings for backward compatibility. Shrink stored views by removing internal column name list from visible rte. Implement min(), max() for time and timetz data types. Implement conversion of TIME to INTERVAL. Implement abs(), mod(), fac() for the int8 data type. Rename some math functions to generic names: round(), sqrt(), cbrt(), pow(), etc. Rename NUMERIC power() function to pow(). Fix int2 factorial to calculate result in int4. Enhance the Oracle compatibility function translate() to work with string arguments (from Edwin Ramirez). Modify pg_proc system table to remove OID holes.
* Repair longstanding violation of SQL92 semantics: GROUP BY wouldTom Lane2000-02-19
| | | | | | | | | | | | | | interpret a column name as an output column alias (targetlist AS name), ather than a real column name as it ought to. According to the spec, only ORDER BY should look at output column names. I left in GROUP BY's willingness to use an output column number ('GROUP BY 2'), even though this is also contrary to the spec --- again, only ORDER BY is supposed to accept that. But there is no possible reason to want to GROUP BY an integer constant, so keeping this old behavior won't break any SQL-compliant queries. DISTINCT ON will behave the same as GROUP BY. Change numerology regress test, which depended on the incorrect behavior.
* Fix missing lfirst() in ListTableAsAttrs(). This codeTom Lane2000-02-15
| | | | doesn't seem to be used at the moment, but as long as I'm looking at it...
* Remove some // comments, which are not ANSI C last I heard.Tom Lane2000-02-15
|
* Carry column aliases from the parser frontend. Enables queries likeThomas G. Lockhart2000-02-15
| | | | | | | SELECT a FROM t1 tx (a); Allow join syntax, including queries like SELECT * FROM t1 NATURAL JOIN t2; Update RTE structure to hold column aliases in an Attr structure.
* Redesign DISTINCT ON as discussed in pgsql-sql 1/25/00: syntax is nowTom Lane2000-01-27
| | | | | | | | | | | | | SELECT DISTINCT ON (expr [, expr ...]) targetlist ... and there is a check to make sure that the user didn't specify an ORDER BY that's incompatible with the DISTINCT operation. Reimplement nodeUnique and nodeGroup to use the proper datatype-specific equality function for each column being compared --- they used to do bitwise comparisons or convert the data to text strings and strcmp(). (To add insult to injury, they'd look up the conversion functions once for each tuple...) Parse/plan representation of DISTINCT is now a list of SortClause nodes. initdb forced by querytree change...
* Add:Bruce Momjian2000-01-26
| | | | | | * Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.
* Pass atttypmod to CoerceTargetExpr, so that it can pass it on toTom Lane2000-01-17
| | | | | coerce_type, so that the right things happen when coercing a previously- unknown constant to a destination data type.
* Re-enable makeAttr() if ENABLE_OUTER_JOINS is defined.Thomas G. Lockhart1999-12-17
| | | | Somehow got bracketed with #ifdef NOT_USED instead.
* I have a patch for postgresql-snapshot(1999-10-22).Bruce Momjian1999-10-22
| | | | | | | | | | | | This patch fix a TODO list item. * require SELECT DISTINCT target list to have all ORDER BY columns example ogawa=> select distinct x from t1 order by y; ERROR: ORDER BY columns must appear in SELECT DISTINCT target list --- Atsushi Ogawa
* Fix planner and rewriter to follow SQL semantics for tables that areTom Lane1999-10-07
| | | | | | | | | | | mentioned in FROM but not elsewhere in the query: such tables should be joined over anyway. Aside from being more standards-compliant, this allows removal of some very ugly hacks for COUNT(*) processing. Also, allow HAVING clause without aggregate functions, since SQL does. Clean up CREATE RULE statement-list syntax the same way Bruce just fixed the main stmtmulti production. CAUTION: addition of a field to RangeTblEntry nodes breaks stored rules; you will have to initdb if you have any rules.
* Mega-commit to make heap_open/heap_openr/heap_close take anTom Lane1999-09-18
| | | | | | | | | | | | | | | | | additional argument specifying the kind of lock to acquire/release (or 'NoLock' to do no lock processing). Ensure that all relations are locked with some appropriate lock level before being examined --- this ensures that relevant shared-inval messages have been processed and should prevent problems caused by concurrent VACUUM. Fix several bugs having to do with mismatched increment/decrement of relation ref count and mismatched heap_open/close (which amounts to the same thing). A bogus ref count on a relation doesn't matter much *unless* a SI Inval message happens to arrive at the wrong time, which is probably why we got away with this sloppiness for so long. Repair missing grab of AccessExclusiveLock in DROP TABLE, ALTER/RENAME TABLE, etc, as noted by Hiroshi. Recommend 'make clean all' after pulling this update; I modified the Relation struct layout slightly. Will post further discussion to pghackers list shortly.
* Major revision of sort-node handling: push knowledge of queryTom Lane1999-08-21
| | | | | | | | | | | | | sort order down into planner, instead of handling it only at the very top level of the planner. This fixes many things. An explicit sort is now avoided if there is a cheaper alternative (typically an indexscan) not only for ORDER BY, but also for the internal sort of GROUP BY. It works even when there is no other reason (such as a WHERE condition) to consider the indexscan. It works for indexes on functions. It works for indexes on functions, backwards. It's just so cool... CAUTION: I have changed the representation of SortClause nodes, therefore THIS UPDATE BREAKS STORED RULES. You will need to initdb.
* Small updates to #include lists for pending optimizer checkin.Tom Lane1999-08-16
|
* Rewrite parser's handling of INSERT ... SELECT so that processingTom Lane1999-07-19
| | | | | | | | | of the SELECT part of the statement is just like a plain SELECT. All INSERT-specific processing happens after the SELECT parsing is done. This eliminates many problems, e.g. INSERT ... SELECT ... GROUP BY using the wrong column labels. Ensure that DEFAULT clauses are coerced to the target column type, whether or not stored clause produces the right type. Substantial cleanup of parser's array support.
* Move some system includes into c.h, and remove duplicates.Bruce Momjian1999-07-17
|
* Final cleanup.Bruce Momjian1999-07-16
|
* Remove unused #includes in *.c files.Bruce Momjian1999-07-15
|
* Clean up #include in /include directory. Add scripts for checking includes.Bruce Momjian1999-07-15
|
* Make functions static or NOT_USED as appropriate.Bruce Momjian1999-05-26
|
* pgindent run over code.Bruce Momjian1999-05-25
|
* Make postgres prompt backend>, and remove PARSEDEBUG.Bruce Momjian1999-05-22
|
* Skip junk nodes when comparing UNION target list lengths.Bruce Momjian1999-05-17
|
* Change resjunk to a boolean.Bruce Momjian1999-05-17
|
* Surround a variable declaration with ENABLE_OUTER_JOINS to suppressThomas G. Lockhart1999-05-13
| | | | compiler warnings about an unused variable.
* Rip out QueryTreeList structure, root and branch. QuerytreeTom Lane1999-05-13
| | | | | | | | | | lists are now plain old garden-variety Lists, allocated with palloc, rather than specialized expansible-array data allocated with malloc. This substantially simplifies their handling and eliminates several sources of memory leakage. Several basic types of erroneous queries (syntax error, attempt to insert a duplicate key into a unique index) now demonstrably leak zero bytes per query.
* Replaced targetlist entry in GroupClause by reference numberJan Wieck1999-05-12
| | | | | | | in Resdom and GroupClause so changing of resno's doesn't confuse the grouping any more. Jan
* Include some new code for outer joins. Disabled by default, but enable byThomas G. Lockhart1999-02-23
| | | | | including the following in your Makefile.custom: CFLAGS+= -DENABLE_OUTER_JOINS -DEXEC_MERGEJOINDEBUG
* Change my-function-name-- to my_function_name, and optimizer renames.Bruce Momjian1999-02-13
|
* Fixed failed assertion happening in multiple action rulesJan Wieck1999-02-02
| | | | | | | when parsestate in makeRangeTable() already contains an opened p_target_relation. Jan
* Clean up code in analyze.c for SERIAL data type.Thomas G. Lockhart1998-09-25
| | | | Remove _all_ PARSEDEBUG print statements.
* OK, folks, here is the pgindent output.Bruce Momjian1998-09-01
|
* Make sure resdomno for update/insert match attribute number forBruce Momjian1998-08-25
| | | | | rewrite system. Restructure parse_target to make it easier to understand.
* From: David Hartwig <daybee@bellatlantic.net>Marc G. Fournier1998-08-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have attached a patch to allow GROUP BY and/or ORDER BY function or expressions. Note worthy items: 1. The expression or function need not be in the target list. Example: SELECT name FROM foo GROUP BY lower(name); 2. Simplified the grammar to use expressions only. 3. Cleaned up earlier patch in this area to make use of existing utility functions. 3. Reduced some of the members in the SortGroupBy parse node. The original data members were redundant with the new expression node. (MUST do a "make clean" now) 4. Added a new parse node "JoinUsing". The JOIN USING clause was overloading this SortGroupBy structure. With the afore mentioned reduction of members, the two clauses lost all their commonality. 5. A bug still exist where, if a function or expression is GROUPed BY, and an aggregate function does not include a attribute from the expression or function, the backend crashes. (or something like that) The bug pre-dates this patch. Example: SELECT lower(a) AS lowcase, count(b) FROM foo GROUP BY lowcase; *** BOOM *** --Also when not in target list SELECT count(b) FROM foo GROUP BY lower(a); *** BOOM AGAIN ***
* Allows the following query to succeed: "SELECT NULL ORDER BY 1;"Thomas G. Lockhart1998-08-02
| | | | | | | | | | There are three or four cases in transformSortClause() and I had fixed only one case for UNION. A second case is now fixed, in the same way; I assigned INT4OID to the column type for the "won't actually happen" sort. Didn't want to skip the code entirely, since the backend needs to _try_ a sort to get the NULLs right. I'm not certain under what circumstances the other cases are invoked and these are not yet fixed up, though perhaps they don't need to be...
* Fix for UNION selects with constant NULL expressions; e.g.Thomas G. Lockhart1998-07-14
| | | | SELECT 1 UNION SELECT NULL;
* Handle case of GROUP BY target list column number out of range.Thomas G. Lockhart1998-07-09
|
* Allow floating point constants for "def_arg" numeric arguments.Thomas G. Lockhart1998-07-08
| | | | | | Used in the generic "CREATE xxx" parsing. Do some automatic type conversion for inserts from other columns. Previous trouble with "resjunk" regression test remains for now.
* I made several adjustments to my earlier patch to handle theBruce Momjian1998-06-05
| | | | condition where the target label is ambiguous.
* Do type conversion to match columns in UNION clauses.Thomas G. Lockhart1998-05-29
| | | | | | | | | | | Currently force the type to match the _first_ select in the union. Move oper_select_candidate() from parse_func.c to parse_oper.c. Throw error inside of oper_inexact() if no match for binary operators. Check more carefully that types can be coerced even if there is only one candidate operator in oper_inexact(). Fix up error messages for more uniform look. Remove unused code. Fix up comments.
* From: David Hartwig <daveh@insightdist.com>Marc G. Fournier1998-05-21
| | | | | Here is a patch to remove the requirement that ORDER/GROUP BY clause identifiers be included in the target list.
* Merge rename name page into alter table. Fix UNION with DISTINCTBruce Momjian1998-03-31
| | | | or ORDER BY bug.
* Add checks for UNION target fields, and add optional TABLE to LOCKBruce Momjian1998-03-18
| | | | and SELECT manual pages and psql help.
* pgindent run before 6.3 release, with Thomas' requested changes.Bruce Momjian1998-02-26
|
* FIx for regression-test found bug.Bruce Momjian1998-01-20
|
* Add Var.varlevelup to code. More parser cleanup.Bruce Momjian1998-01-20
|
* Parser cleanup.Bruce Momjian1998-01-20
| | | | Add lock to i386 asm.
* Create SubLink nodes in parser for Vadim.Bruce Momjian1998-01-19
|
* Fix sorting of multiple fields broken with UNION.Bruce Momjian1998-01-06
|