summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_clause.c
AgeCommit message (Collapse)Author
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.
1998-03-31Merge rename name page into alter table. Fix UNION with DISTINCTBruce Momjian
or ORDER BY bug.
1998-03-18Add checks for UNION target fields, and add optional TABLE to LOCKBruce Momjian
and SELECT manual pages and psql help.
1998-02-26pgindent run before 6.3 release, with Thomas' requested changes.Bruce Momjian
1998-01-20FIx for regression-test found bug.Bruce Momjian
1998-01-20Add Var.varlevelup to code. More parser cleanup.Bruce Momjian
1998-01-20Parser cleanup.Bruce Momjian
Add lock to i386 asm.
1998-01-19Create SubLink nodes in parser for Vadim.Bruce Momjian
1998-01-06Fix sorting of multiple fields broken with UNION.Bruce Momjian
1998-01-05Change elog(WARN) to elog(ERROR) and elog(ABORT).Bruce Momjian
1997-12-29Fix for ORDER BY in UNION.Bruce Momjian
1997-12-29UNION cleanup again.Bruce Momjian
1997-12-29Cleanup of UNION ALL fix. Manual page updates.Bruce Momjian
1997-11-26Make parser functions static where possible.Bruce Momjian
1997-11-26Cleanup up include files.Bruce Momjian
1997-11-25Break parser functions into smaller files, group together.Bruce Momjian