summaryrefslogtreecommitdiff
path: root/src/backend/nodes
AgeCommit message (Collapse)Author
2000-06-18Reimplement nodeMaterial to use a temporary BufFile (or even memory, if theTom Lane
materialized tupleset is small enough) instead of a temporary relation. This was something I was thinking of doing anyway for performance, and Jan says he needs it for TOAST because he doesn't want to cope with toasting noname relations. With this change, the 'noname table' support in heap.c is dead code, and I have accordingly removed it. Also clean up 'noname' plan handling in planner --- nonames are either sort or materialize plans, and it seems less confusing to handle them separately under those names.
2000-06-16Repair unforgivably brain-dead representation of CaseExpr nodes inTom Lane
stored rules. Bump catversion to reflect incompatibility.
2000-06-14Big warnings cleanup for Solaris/GCC. Down to about 40 now, butPeter Eisentraut
we'll get there one day. Use `cat' to create aclocal.m4, not `aclocal'. Some people don't have automake installed. Only run the autoconf rule in the top-level GNUmakefile if the invoker specified `make configure', don't run it automatically because of CVS timestamp skew.
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-28First round of changes for new fmgr interface. fmgr itself and theTom Lane
key call sites are changed, but most called functions are still oldstyle. An exception is that the PL managers are updated (so, for example, NULL handling now behaves as expected in plperl and plpgsql functions). NOTE initdb is forced due to added column in pg_proc.
2000-05-25Clean up sloppy coding of _outAExpr().Tom Lane
2000-04-26Tweak outUnique to include uniqColIdx[] field in the printout. This doesTom Lane
not cause any compatibility problems because stored rules don't contain plan nodes --- in fact, we don't even have a readfunc for Unique nodes.
2000-04-12Ye-old pgindent run. Same 4-space tabs.Bruce Momjian
2000-04-08Add copyObject logic for TruncateStmt and a few other utility-statementTom Lane
parse node types. This allows these statements to be placed in a plpgsql function. Also, see to it that statement types not handled by the copy logic will draw an appropriate elog(ERROR), instead of leaving a null pointer that will cause coredump later on. More utility statements could be added if anyone felt like turning the crank.
2000-04-04Fix extremely nasty little bug observed when a sub-SELECT appears inTom Lane
WHERE in a place where it can be part of a nestloop inner indexqual. As the code stood, it put the same physical sub-Plan node into both indxqual and indxqualorig of the IndexScan plan node. That confused later processing in the optimizer (which expected that tracing the subPlan list would visit each subplan node exactly once), and would probably have blown up in the executor if the planner hadn't choked first. Fix by making the 'fixed' indexqual be a complete deep copy of the original indexqual, rather than trying to share nodes below the topmost operator node. This had further ramifications though, because we were making the aforesaid list of sub-Plan nodes during SS_process_sublinks which is run before construction of the 'fixed' indexqual, meaning that the copy of the sub-Plan didn't show up in that list. Fix by rearranging logic so that the sub-Plan list is built by the final set_plan_references pass, not in SS_process_sublinks. This may sound like a mess, but it's actually a good deal cleaner now than it was before, because we are no longer dependent on the assumption that planning will never make a copy of a sub-Plan node.
2000-03-24outfuncs.c was missing a print routine for Material plan nodes, leadingTom Lane
to trouble when trying to EXPLAIN VERBOSE a plan containing one.
2000-03-22Repair logic flaw in cost estimator: cost_nestloop() was estimating CPUTom Lane
costs using the inner path's parent->rows count as the number of tuples processed per inner scan iteration. This is wrong when we are using an inner indexscan with indexquals based on join clauses, because the rows count in a Relation node reflects the selectivity of the restriction clauses for that rel only. Upshot was that if join clause was very selective, we'd drastically overestimate the true cost of the join. Fix is to calculate correct output-rows estimate for an inner indexscan when the IndexPath node is created and save it in the path node. Change of path node doesn't require initdb, since path nodes don't appear in saved rules.
2000-03-17Fix a bunch of minor portability problems and maybe-bugs revealed byTom Lane
running gcc and HP's cc with warnings cranked way up. Signed vs unsigned comparisons, routines declared static and then defined not-static, that kind of thing. Tedious, but perhaps useful...
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-03-01equalAttr() had its strcmp test backwards :-(Tom Lane
2000-02-21Change parse-time representation of float literals (which include oversizeTom Lane
integers) to be strings instead of 'double'. We convert from string form to internal representation only after type resolution has determined the correct type for the constant. This eliminates loss-of-precision worries and gets rid of the change in behavior seen at 17 digits with the previous kluge.
2000-02-20Create a new expression node type RelabelType, which exists solely toTom Lane
represent the result of a binary-compatible type coercion. At runtime it just evaluates its argument --- but during type resolution, exprType will pick up the output type of the RelabelType node instead of the type of the argument. This solves some longstanding problems with dropped type coercions, an example being 'select now()::abstime::int4' which used to produce date-formatted output, not an integer, because the coercion to int4 was dropped on the floor.
2000-02-15New cost model for planning, incorporating a penalty for random pageTom Lane
accesses versus sequential accesses, a (very crude) estimate of the effects of caching on random page accesses, and cost to evaluate WHERE- clause expressions. Export critical parameters for this model as SET variables. Also, create SET variables for the planner's enable flags (enable_seqscan, enable_indexscan, etc) so that these can be controlled more conveniently than via PGOPTIONS. Planner now estimates both startup cost (cost before retrieving first tuple) and total cost of each path, so it can optimize queries with LIMIT on a reasonable basis by interpolating between these costs. Same facility is a win for EXISTS(...) subqueries and some other cases. Redesign pathkey representation to achieve a major speedup in planning (I saw as much as 5X on a 10-way join); also minor changes in planner to reduce memory consumption by recycling discarded Path nodes and not constructing unnecessary lists. Minor cleanups to display more-plausible costs in some cases in EXPLAIN output. Initdb forced by change in interface to index cost estimation functions.
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-02-07Repair planning bugs caused by my misguided removal of restrictinfo linkTom Lane
fields in JoinPaths --- turns out that we do need that after all :-(. Also, rearrange planner so that only one RelOptInfo is created for a particular set of joined base relations, no matter how many different subsets of relations it can be created from. This saves memory and processing time compared to the old method of making a bunch of RelOptInfos and then removing the duplicates. Clean up the jointree iteration logic; not sure if it's better, but I sure find it more readable and plausible now, particularly for the case of 'bushy plans'.
2000-02-06Rename same() to sameseti() to have a slightly less generic name. MoveTom Lane
nonoverlap_sets() and is_subset() to list.c, where they should have lived to begin with, and rename to nonoverlap_setsi and is_subseti since they only work on integer lists.
2000-01-31Hmm, equalfuncs didn't know about SortClause or GroupClauseTom Lane
nodes...
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-22Revise handling of index-type-specific indexscan cost estimation, perTom Lane
pghackers discussion of 5-Jan-2000. The amopselect and amopnpages estimators are gone, and in their place is a per-AM amcostestimate procedure (linked to from pg_am, not pg_amop).
2000-01-17Create a new parsetree node type, TypeCast, so that transformation ofTom Lane
SQL cast constructs can be performed during expression transformation instead of during parsing. This allows constructs like x::numeric(9,2) and x::int2::float8 to behave as one would expect.
2000-01-14Revise quoting conventions in outfuncs/readfuncs so that nodeRead doesn'tTom Lane
choke on relation or attribute names containing spaces, quotes, or other special characters. This fixes a TODO item. It also forces initdb, since stored rule strings change.
2000-01-09Another round of planner/optimizer work. This is just restructuring andTom Lane
code cleanup; no major improvements yet. However, EXPLAIN does produce more intuitive outputs for nested loops with indexscans now...
1999-12-24Clean up handling of explicit NULL constants. Cases likeTom Lane
SELECT null::text; SELECT int4fac(null); work as expected now. In some cases a NULL must be surrounded by parentheses: SELECT 2 + null; fails SELECT 2 + (null); OK This is a grammatical ambiguity that seems difficult to avoid. Other than that, NULLs seem to behave about like you'd expect. The internal implementation is that NULL constants are typed as UNKNOWN (like untyped string constants) until the parser can deduce the right type.
1999-12-16Some changes to prepare for LONG attributes.Jan Wieck
Jan
1999-12-13New LDOUT makefile variable for QNX os.Bruce Momjian
1999-12-13aggregate(DISTINCT ...) works, per SQL spec.Tom Lane
Note this forces initdb because of change of Aggref node in stored rules.
1999-12-10Teach grammar and parser about aggregate(DISTINCT ...). No implementationTom Lane
yet, but at least we can give a better error message: regression=> select count(distinct f1) from int4_tbl; ERROR: aggregate(DISTINCT ...) is not implemented yet instead of 'parser: parse error at or near distinct'.
1999-12-09Make LD -r as macros that can be changed for QNX.Bruce Momjian
1999-11-23Tid access method feature from Hiroshi Inoue, Inoue@tpf.co.jpBruce Momjian
1999-11-15Clean up possible memory leakage in nodeSubplanTom Lane
1999-11-15Implement subselects in target lists. Also, relax requirement thatTom Lane
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.
1999-11-01Eliminate some unbelievably cheesy code in _copyConst().Tom Lane
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.
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-10-03Reimplement parsing and storage of default expressions and constraintTom Lane
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.
1999-09-26Implement constant-expression simplification per BernardTom Lane
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.
1999-08-31Minor improvements to stringinfo package to make it moreTom Lane
robust, since it's about to get used much more heavily.
1999-08-22Further planner/optimizer cleanups. Move all set_tlist_referencesTom Lane
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 ...
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-16Major planner/optimizer revision: get rid of PathOrder node type,Tom Lane
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.
1999-08-14LispUnion routine didn't generate a proper union: anytimeTom Lane
l2 contained more than one entry, there would be duplicates in the output list. Miscellaneous code beautification in other routines, too.
1999-08-09> > Prevent sorting if result is already sortedBruce Momjian
> > > > 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