summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_clause.c
AgeCommit message (Collapse)Author
2000-06-15Clean up #include's.Bruce Momjian
2000-06-09Inheritance overhaul by Chris Bitmead <chris@bitmead.com>Bruce Momjian
2000-06-08Mark functions as static and ifdef NOT_USED as appropriate.Bruce Momjian
2000-05-30Remove unused include files. Do not touch /port or includes used by defines.Bruce Momjian
2000-05-29Generated header files parse.h and fmgroids.h are now copied intoTom Lane
the src/include tree, so that -I backend is no longer necessary anywhere. Also, clean up some bit rot in contrib tree.
2000-05-12Repair list-vs-node confusion that resulted in failure for INNER JOIN ON.Tom Lane
Make it behave correctly when there are more than two tables being joined, also. Update regression test expected outputs.
2000-04-12Ye-old pgindent run. Same 4-space tabs.Bruce Momjian
2000-03-23Remove no-longer-necessary restriction against uplevel correlation varsTom Lane
outside WHERE clause. Fix a couple of places that didn't handle uplevel refs cleanly.
2000-03-15Tweak GROUP BY so that it will still accept result-column names, but onlyTom Lane
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.
2000-03-14Implement column aliases on views "CREATE VIEW name (collist)".Thomas G. Lockhart
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.
2000-02-19Repair longstanding violation of SQL92 semantics: GROUP BY wouldTom Lane
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.
2000-02-15Fix missing lfirst() in ListTableAsAttrs(). This codeTom Lane
doesn't seem to be used at the moment, but as long as I'm looking at it...
2000-02-15Remove some // comments, which are not ANSI C last I heard.Tom Lane
2000-02-15Carry column aliases from the parser frontend. Enables queries likeThomas G. Lockhart
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.
2000-01-27Redesign DISTINCT ON as discussed in pgsql-sql 1/25/00: syntax is nowTom Lane
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...
2000-01-26Add:Bruce Momjian
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.
2000-01-17Pass atttypmod to CoerceTargetExpr, so that it can pass it on toTom Lane
coerce_type, so that the right things happen when coercing a previously- unknown constant to a destination data type.
1999-12-17Re-enable makeAttr() if ENABLE_OUTER_JOINS is defined.Thomas G. Lockhart
Somehow got bracketed with #ifdef NOT_USED instead.
1999-10-22I have a patch for postgresql-snapshot(1999-10-22).Bruce Momjian
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
1999-10-07Fix planner and rewriter to follow SQL semantics for tables that areTom Lane
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.
1999-09-18Mega-commit to make heap_open/heap_openr/heap_close take anTom Lane
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.
1999-08-21Major revision of sort-node handling: push knowledge of queryTom Lane
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.
1999-08-16Small updates to #include lists for pending optimizer checkin.Tom Lane
1999-07-19Rewrite parser's handling of INSERT ... SELECT so that processingTom Lane
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.
1999-07-17 Move some system includes into c.h, and remove duplicates.Bruce Momjian
1999-07-16Final cleanup.Bruce Momjian
1999-07-15Remove unused #includes in *.c files.Bruce Momjian
1999-07-15Clean up #include in /include directory. Add scripts for checking includes.Bruce Momjian
1999-05-26Make functions static or NOT_USED as appropriate.Bruce Momjian
1999-05-25pgindent run over code.Bruce Momjian
1999-05-22Make postgres prompt backend>, and remove PARSEDEBUG.Bruce Momjian
1999-05-17Skip junk nodes when comparing UNION target list lengths.Bruce Momjian
1999-05-17Change resjunk to a boolean.Bruce Momjian
1999-05-13Surround a variable declaration with ENABLE_OUTER_JOINS to suppressThomas G. Lockhart
compiler warnings about an unused variable.
1999-05-13Rip out QueryTreeList structure, root and branch. QuerytreeTom Lane
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.
1999-05-12Replaced targetlist entry in GroupClause by reference numberJan Wieck
in Resdom and GroupClause so changing of resno's doesn't confuse the grouping any more. Jan
1999-02-23Include some new code for outer joins. Disabled by default, but enable byThomas G. Lockhart
including the following in your Makefile.custom: CFLAGS+= -DENABLE_OUTER_JOINS -DEXEC_MERGEJOINDEBUG
1999-02-13Change my-function-name-- to my_function_name, and optimizer renames.Bruce Momjian
1999-02-02Fixed failed assertion happening in multiple action rulesJan Wieck
when parsestate in makeRangeTable() already contains an opened p_target_relation. Jan
1998-09-25Clean up code in analyze.c for SERIAL data type.Thomas G. Lockhart
Remove _all_ PARSEDEBUG print statements.
1998-09-01OK, folks, here is the pgindent output.Bruce Momjian
1998-08-25Make sure resdomno for update/insert match attribute number forBruce Momjian
rewrite system. Restructure parse_target to make it easier to understand.
1998-08-05From: David Hartwig <daybee@bellatlantic.net>Marc G. Fournier
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 ***
1998-08-02Allows the following query to succeed: "SELECT NULL ORDER BY 1;"Thomas G. Lockhart
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...
1998-07-14Fix for UNION selects with constant NULL expressions; e.g.Thomas G. Lockhart
SELECT 1 UNION SELECT NULL;
1998-07-09Handle case of GROUP BY target list column number out of range.Thomas G. Lockhart
1998-07-08Allow floating point constants for "def_arg" numeric arguments.Thomas G. Lockhart
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.
1998-06-05I made several adjustments to my earlier patch to handle theBruce Momjian
condition where the target label is ambiguous.
1998-05-29Do type conversion to match columns in UNION clauses.Thomas G. Lockhart
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.
1998-05-21From: David Hartwig <daveh@insightdist.com>Marc G. Fournier
Here is a patch to remove the requirement that ORDER/GROUP BY clause identifiers be included in the target list.