summaryrefslogtreecommitdiff
path: root/src/backend/nodes
Commit message (Collapse)AuthorAgeFilesLines
* Implement subselects in target lists. Also, relax requirement thatTom Lane1999-11-151-6/+8
| | | | | | | | | | | | | subselects can only appear on the righthand side of a binary operator. That's still true for quantified predicates like x = ANY (SELECT ...), but a subselect that delivers a single result can now appear anywhere in an expression. This is implemented by changing EXPR_SUBLINK sublinks to represent just the (SELECT ...) expression, without any 'left hand side' or combining operator --- so they're now more like EXISTS_SUBLINK. To handle the case of '(x, y, z) = (SELECT ...)', I added a new sublink type MULTIEXPR_SUBLINK, which acts just like EXPR_SUBLINK used to. But the grammar will only generate one for a multiple-left-hand-side row expression.
* Eliminate some unbelievably cheesy code in _copyConst().Tom Lane1999-11-011-114/+56
| | | | | | | | Apparently, back in the dim reaches of prehistory, the parser couldn't be trusted to label Const nodes with the correct constbyval value ... and someone preferred to patch around this in copyObject rather than fix the problem at the source. The problem is long gone, but the hack lingered on. Until now.
* Fix planner and rewriter to follow SQL semantics for tables that areTom Lane1999-10-074-6/+13
| | | | | | | | | | | 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.
* Reimplement parsing and storage of default expressions and constraintTom Lane1999-10-031-7/+14
| | | | | | | | | | | | | | | expressions in CREATE TABLE. There is no longer an emasculated expression syntax for these things; it's full a_expr for constraints, and b_expr for defaults (unfortunately the fact that NOT NULL is a part of the column constraint syntax causes a shift/reduce conflict if you try a_expr. Oh well --- at least parenthesized boolean expressions work now). Also, stored expression for a column default is not pre-coerced to the column type; we rely on transformInsertStatement to do that when the default is actually used. This means "f1 datetime default 'now'" behaves the way people usually expect it to. BTW, all the support code is now there to implement ALTER TABLE ADD CONSTRAINT and ALTER TABLE ADD COLUMN with a default value. I didn't actually teach ALTER TABLE to call it, but it wouldn't be much work.
* Implement constant-expression simplification per BernardTom Lane1999-09-261-2/+21
| | | | | | | | | | | Frankpitt, plus some improvements from yours truly. The simplifier depends on the proiscachable field of pg_proc to tell it whether a function is safe to pre-evaluate --- things like nextval() are not, for example. Update pg_proc.h to contain reasonable cacheability information; as of 6.5.* hardly any functions were marked cacheable. I may have erred too far in the other direction; see recent mail to pghackers for more info. This update does not force an initdb, exactly, but you won't see much benefit from the simplifier until you do one.
* Minor improvements to stringinfo package to make it moreTom Lane1999-08-311-1/+5
| | | | robust, since it's about to get used much more heavily.
* Further planner/optimizer cleanups. Move all set_tlist_referencesTom Lane1999-08-221-6/+10
| | | | | | | | | | and fix_opids processing to a single recursive pass over the plan tree executed at the very tail end of planning, rather than haphazardly here and there at different places. Now that tlist Vars do not get modified until the very end, it's possible to get rid of the klugy var_equal and match_varid partial-matching routines, and just use plain equal() throughout the optimizer. This is a step towards allowing merge and hash joins to be done on expressions instead of only Vars ...
* Major revision of sort-node handling: push knowledge of queryTom Lane1999-08-216-97/+81
| | | | | | | | | | | | | 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.
* Major planner/optimizer revision: get rid of PathOrder node type,Tom Lane1999-08-168-853/+167
| | | | | | | | | store all ordering information in pathkeys lists (which are now lists of lists of PathKeyItem nodes, not just lists of lists of vars). This was a big win --- the code is smaller and IMHO more understandable than it was, even though it handles more cases. I believe the node changes will not force an initdb for anyone; planner nodes don't show up in stored rules.
* LispUnion routine didn't generate a proper union: anytimeTom Lane1999-08-141-212/+133
| | | | | l2 contained more than one entry, there would be duplicates in the output list. Miscellaneous code beautification in other routines, too.
* > > Prevent sorting if result is already sortedBruce Momjian1999-08-094-4/+14
| | | | | | | | | | | | | | > > > > was implemented by Jan Wieck. > > His work is for ascending order cases. > > > > Here is a patch to prevent sorting also in descending > > order cases. > > Because I had already changed _bt_first() to position > > backward correctly before v6.5,this patch would work. > > Hiroshi Inoue Inoue@tpf.co.jp
* Add equal() funcs for Case nodes ... amazing we had notTom Lane1999-07-291-178/+164
| | | | detected this omission before. Miscellaneous other cleanups.
* First cut at doing LIKE/regex indexing optimization inTom Lane1999-07-272-4/+2
| | | | | | | | | | | | | | | | | | optimizer rather than parser. This has many advantages, such as not getting fooled by chance uses of operator names ~ and ~~ (the operators are identified by OID now), and not creating useless comparison operations in contexts where the comparisons will not actually be used as indexquals. The new code also recognizes exact-match LIKE and regex patterns, and produces an = indexqual instead of >= and <=. This change does NOT fix the problem with non-ASCII locales: the code still doesn't know how to generate an upper bound indexqual for non-ASCII collation order. But it's no worse than before, just the same deficiency in a different place... Also, dike out loc_restrictinfo fields in Plan nodes. These were doing nothing useful in the absence of 'expensive functions' optimization, and they took a considerable amount of processing to fill in.
* Remove 'restrictinfojoinid' field from RestrictInfo nodes.Tom Lane1999-07-252-4/+2
| | | | | | | The only place it was being used was as temporary storage in indxpath.c, and the logic was wrong: the same restrictinfo node could get chosen to carry the info for two different joins. Right fix is to return a second list of unjoined-relids parallel to the list of clause groups.
* Clean up messy clause-selectivity code in clausesel.c; repair bugTom Lane1999-07-244-18/+6
| | | | | | | | | | | | | | | | | | | | identified by Hiroshi (incorrect cost attributed to OR clauses after multiple passes through set_rest_selec()). I think the code was trying to allow selectivities of OR subclauses to be passed in from outside, but noplace was actually passing any useful data, and set_rest_selec() was passing wrong data. Restructure representation of "indexqual" in IndexPath nodes so that it is the same as for indxqual in completed IndexScan nodes: namely, a toplevel list with an entry for each pass of the index scan, having sublists that are implicitly-ANDed index qual conditions for that pass. You don't want to know what the old representation was :-( Improve documentation of OR-clause indexscan functions. Remove useless 'notclause' field from RestrictInfo nodes. (This might force an initdb for anyone who has stored rules containing RestrictInfos, but I do not think that RestrictInfo ever appears in completed plans.)
* Fix typo in _outArrayRef().Tom Lane1999-07-181-2/+2
|
* Move some system includes into c.h, and remove duplicates.Bruce Momjian1999-07-179-24/+10
|
* Final cleanup.Bruce Momjian1999-07-166-23/+20
|
* Remove unused #includes in *.c files.Bruce Momjian1999-07-158-57/+9
|
* Clean up #include in /include directory. Add scripts for checking includes.Bruce Momjian1999-07-158-24/+8
|
* Cleanup of /include #include's, for 6.6 only.Bruce Momjian1999-07-142-4/+5
|
* Remove S*I comments from Stephan.Bruce Momjian1999-07-131-2/+1
|
* equal() needs a case for Aggref nodes, as shown by:Tom Lane1999-06-061-1/+25
| | | | | regression=> select sum(q1) from int8_tbl group by q2 order by sum(q1); NOTICE: equal: don't know whether nodes of type 107 are equal
* Make functions static or NOT_USED as appropriate.Bruce Momjian1999-05-261-2/+3
|
* Another pgindent run. Sorry folks.Bruce Momjian1999-05-254-45/+45
|
* pgindent run over code.Bruce Momjian1999-05-257-352/+365
|
* Upgrade to PyGreSQL (2.4)Bruce Momjian1999-05-192-7/+3
|
* Remove no-longer-used fields in Hash and HashJoin nodes.Tom Lane1999-05-183-46/+6
|
* Change resjunk to a boolean.Bruce Momjian1999-05-173-7/+7
|
* Replaced targetlist entry in GroupClause by reference numberJan Wieck1999-05-126-19/+28
| | | | | | | in Resdom and GroupClause so changing of resno's doesn't confuse the grouping any more. Jan
* Change error messages to oids come out as %u and not %d. Change has noBruce Momjian1999-05-102-10/+10
| | | | real affect now.
* Fix for _copyUnique() suggested by Hiroshi InoueTatsuo Ishii1999-04-271-2/+2
|
* Revise backend libpq interfaces so that messages to the frontendTom Lane1999-04-251-13/+7
| | | | | | can be generated in a buffer and then sent to the frontend in a single libpq call. This solves problems with NOTICE and ERROR messages generated in the middle of a data message or COPY OUT operation.
* Repair some problems in planner's handling of HAVING clauses.Tom Lane1999-04-191-2/+5
| | | | | This fixes a few of the problems Hiroshi Inoue complained of, but I have not touched the rewrite-related issues.
* Remove Tee code, move to _deadcode.Bruce Momjian1999-03-232-22/+2
|
* Partial fix for copied-plan bugs reported by Hiroshi Inoue:Tom Lane1999-03-031-4/+8
| | | | | | | _copyResult didn't copy subPlan structure completely. _copyAgg is still busted, apparently because of changes from EXCEPT/INTERSECT patch (get_agg_tlist_references is no longer sufficient to find all aggregates). No time to look at that tonight, however.
* Executor no longer cares about mergejoinop, mergerightorder, mergeleftorder,Tom Lane1999-03-014-27/+4
| | | | | | | | | so remove them from MergeJoin node. Hack together a partial solution for commuted mergejoin operators --- yesterday a mergejoin int4 = int8 would crash if the planner decided to commute it, today it works. The planner's representation of mergejoins really needs a rewrite though. Also, further testing of mergejoin ops in opr_sanity regress test.
* Add a few other parser-only nodes for debugging help.Thomas G. Lockhart1999-02-231-22/+32
| | | | Define the JoinExpr node.
* Rearrange order of subdirectory creation to help generate parse.hThomas G. Lockhart1999-02-231-2/+7
| | | | | | | | file early enough to use in nodes/. Try to be more complete for rules on generating parse.h, but it still does not work any better than before. Should be able to make correctly if parser/gram.y is updated even without a "make clean" but so far not there yet.
* comments cleanup.Bruce Momjian1999-02-222-17/+13
|
* ifdef out append().Bruce Momjian1999-02-221-1/+3
|
* more cleanupBruce Momjian1999-02-221-2/+75
|
* Final optimizer cleanups.Bruce Momjian1999-02-221-1/+5
|
* fix compile problem.Bruce Momjian1999-02-221-2/+2
|
* pathkeys.c cleanup.Bruce Momjian1999-02-211-2/+2
|
* pathkeys fixesBruce Momjian1999-02-201-7/+15
|
* Fix bushy plans. Cleanup.Bruce Momjian1999-02-185-16/+13
|
* otherrels is now unjoined_relsBruce Momjian1999-02-155-12/+12
|
* Remove duplicate geqo functions, and more optimizer cleanupBruce Momjian1999-02-154-9/+9
|
* Change my-function-name-- to my_function_name, and optimizer renames.Bruce Momjian1999-02-1311-35/+35
|