summaryrefslogtreecommitdiff
path: root/src/backend/executor
AgeCommit message (Collapse)Author
2004-05-26Reimplement the linked list data structure used throughout the backend.Neil Conway
In the past, we used a 'Lispy' linked list implementation: a "list" was merely a pointer to the head node of the list. The problem with that design is that it makes lappend() and length() linear time. This patch fixes that problem (and others) by maintaining a count of the list length and a pointer to the tail node along with each head node pointer. A "list" is now a pointer to a structure containing some meta-data about the list; the head and tail pointers in that structure refer to ListCell structures that maintain the actual linked list of nodes. The function names of the list API have also been changed to, I hope, be more logically consistent. By default, the old function names are still available; they will be disabled-by-default once the rest of the tree has been updated to use the new API names.
2004-05-11Refactor low-level aclcheck code to provide useful interfaces for multi-bitTom Lane
permissions tests in about the same amount of code as before. Exactly what the GRANT/REVOKE code ought to be doing is still up for debate, but this should be helpful in any case, and it already solves an efficiency problem in executor startup.
2004-05-10Promote row expressions to full-fledged citizens of the expression syntax,Tom Lane
rather than allowing them only in a few special cases as before. In particular you can now pass a ROW() construct to a function that accepts a rowtype parameter. Internal generation of RowExprs fixes a number of corner cases that used to not work very well, such as referencing the whole-row result of a JOIN or subquery. This represents a further step in the work I started a month or so back to make rowtype values into first-class citizens.
2004-04-21Tweak indexscan and seqscan code to arrange that steps from one page toTom Lane
the next are handled by ReleaseAndReadBuffer rather than separate ReleaseBuffer and ReadBuffer calls. This cuts the number of acquisitions of the BufMgrLock by a factor of 2 (possibly more, if an indexscan happens to pull successive rows from the same heap page). Unfortunately this doesn't seem enough to get us out of the recently discussed context-switch storm problem, but it's surely worth doing anyway.
2004-04-07Still another place to make the world safe for zero-column tables.Tom Lane
Per example from Jiang Wei.
2004-04-02check_sql_fn_retval has always thought that we supported doingTom Lane
'SELECT foo()' in a SQL function returning a rowtype, to simply pass back the results of another function returning the same rowtype. However, that hasn't actually worked in many years. Now it works again.
2004-04-01Replace TupleTableSlot convention for whole-row variables and functionTom Lane
results with tuples as ordinary varlena Datums. This commit does not in itself do much for us, except eliminate the horrid memory leak associated with evaluation of whole-row variables. However, it lays the groundwork for allowing composite types as table columns, and perhaps some other useful features as well. Per my proposal of a few days ago.
2004-03-24Replace max_expr_depth parameter with a max_stack_depth parameter thatTom Lane
is measured in kilobytes and checked against actual physical execution stack depth, as per my proposal of 30-Dec. This gives us a fairly bulletproof defense against crashing due to runaway recursive functions.
2004-03-23Upgrade ALTER TABLE DROP COLUMN so that it can drop an OID column, andTom Lane
remove separate implementation of ALTER TABLE SET WITHOUT OIDS in favor of doing a regular DROP. Also, cause CREATE TABLE to account completely correctly for the inheritance status of the OID column. This fixes problems with dropping OID columns that have dependencies, as noted by Christopher Kings-Lynne, as well as making sure that you can't drop an OID column that was inherited from a parent.
2004-03-21Revise syntax-error reporting behavior to give pleasant results forTom Lane
errors in internally-generated queries, such as those submitted by plpgsql functions. Per recent discussions with Fabien Coelho.
2004-03-17Reimplement CASE val WHEN compval1 THEN ... WHEN compval2 THEN ... ENDTom Lane
so that the 'val' is computed only once, per recent discussion. The speedup is not much when 'val' is just a simple variable, but could be significant for larger expressions. More importantly this avoids issues with multiple evaluations of a volatile 'val', and it allows the CASE expression to be reverse-listed in its original form by ruleutils.c.
2004-03-17Document SPI_push() and SPI_pop().Bruce Momjian
2004-03-17Replace the switching function ExecEvalExpr() with a macro that jumpsTom Lane
directly to the appropriate per-node execution function, using a function pointer stored by ExecInitExpr. This speeds things up by eliminating one level of function call. The function-pointer technique also enables further small improvements such as only making one-time tests once (and then changing the function pointer). Overall this seems to gain about 10% on evaluation of simple expressions, which isn't earthshaking but seems a worthwhile gain for a relatively small hack. Per recent discussion on pghackers.
2004-03-13Repair memory leakage introduced into the non-hashed aggregate case byTom Lane
7.4 rewrite for hashed aggregate support. If the transition data type is pass-by-reference, the transValue must be pfreed when starting a new group boundary, else we have a one-value-per-group leakage. Thanks to Rae Steining for providing a reproducible test case.
2004-03-05Add new SPI functions for use by PL/Java:Bruce Momjian
+extern Oid SPI_getargtypeid(void *plan, int argIndex); +extern int SPI_getargcount(void *plan); +extern bool SPI_is_cursor_plan(void *plan); Thomas Hallgren
2004-03-02Remove useless rebuilding of subPlan list during ExecInitNode. Wouldn'tTom Lane
have been there to start with, except for overly enthusiastic copy-and- paste ...
2004-03-02Update obsolete comment.Tom Lane
2004-03-02Junkfilter logic to force a projection step during SELECT INTO was tooTom Lane
simplistic; it recognized SELECT * FROM but not SELECT * FROM LIMIT. Per bug report from Jeff Bohmer.
2004-02-28Remove unneeded indxqual field in IndexScanState, and the useless workTom Lane
spent initializing it during indexscan startup.
2004-02-03Rename SortMem and VacuumMem to work_mem and maintenance_work_mem.Tom Lane
Make btree index creation and initial validation of foreign-key constraints use maintenance_work_mem rather than work_mem as their memory limit. Add some code to guc.c to allow these variables to be referenced by their old names in SHOW and SET commands, for backwards compatibility.
2004-01-30Fix debug elog message to agree with name of its routine.Tom Lane
2004-01-22Fix oversight in optimization that avoids an unnecessary projection stepTom Lane
when scanning a table that we need all the columns from. In case of SELECT INTO, we have to check that the hasoids flag matches the desired output type, too. Per report from Mike Mascari.
2004-01-14Fix permission-checking bug reported by Tim Burgess 10-Feb-03 (this timeTom Lane
for sure...). Rather than relying on the query context of a rangetable entry to identify what permissions it wants checked, store a full AclMode mask in each RTE, and check exactly those bits. This allows an RTE specifying, say, INSERT privilege on a view to be copied into a derived UPDATE query without changing meaning. Per recent discussion thread. initdb forced due to change of stored rule representation.
2004-01-10Implement "WITH / WITHOID OIDS" clause for CREATE TABLE AS. This isNeil Conway
intended to allow application authors to insulate themselves from changes to the default value of 'default_with_oids' in future releases of PostgreSQL. This patch also fixes a bug in the earlier implementation of the 'default_with_oids' GUC variable: code in gram.y should not examine the value of GUC variables directly due to synchronization issues.
2004-01-07More janitorial work: remove the explicit casting of NULL literals to aNeil Conway
pointer type when it is not necessary to do so. For future reference, casting NULL to a pointer type is only necessary when (a) invoking a function AND either (b) the function has no prototype OR (c) the function is a varargs function.
2004-01-06Instead of rechecking lossy index operators by putting them into theTom Lane
regular qpqual ('filter condition'), add special-purpose code to nodeIndexscan.c to recheck them. This ends being almost no net addition of code, because the removal of planner code balances out the extra executor code, but it is significantly more efficient when a lossy operator is involved in an OR indexscan. The old implementation had to recheck the entire indexqual in such cases.
2003-12-30Avoid running out of memory during hash_create, by not passing aTom Lane
number-of-buckets that exceeds the size we actually plan to allow the hash table to grow to. Per trouble report from Sean Shanny.
2003-12-28Clean up the usage of canonicalize_qual(): in particular, be consistentTom Lane
about whether it is applied before or after eval_const_expressions(). I believe there were some corner cases where the system would fail to recognize that a partial index is applicable because of the previous inconsistency. Store normal rather than 'implicit AND' representations of constraints and index predicates in the catalogs. initdb forced due to representation change of constraints/predicates.
2003-12-18Use a shutdown callback to clear setArgsValid in a FuncExprState that isTom Lane
evaluating a set-valued function. This fixes some additional problems with rescanning partially-evaluated SRFs.
2003-12-18Ensure set-returning functions in the targetlist of a plan node will beTom Lane
shut down cleanly if the plan node is ReScanned before the SRFs are run to completion. This fixes the problem for SQL-language functions, but still need work on functions using the SRF_XXX() macros.
2003-12-02Add a warning to AtEOXact_SPI() to catch cases where the currentJoe Conway
transaction has been committed without SPI_finish() being called first. Per recent discussion here: http://archives.postgresql.org/pgsql-patches/2003-11/msg00286.php
2003-12-01This patch refactors execTuples.c in two ways.Bruce Momjian
Neil Conway
2003-12-01This patch adds a new GUC var, "default_with_oids", which follows theBruce Momjian
proposal for eventually deprecating OIDs on user tables that I posted earlier to pgsql-hackers. pg_dump now always specifies WITH OIDS or WITHOUT OIDS when dumping a table. The documentation has been updated. Neil Conway
2003-11-29$Header: -> $PostgreSQL Changes ...PostgreSQL Daemon
2003-11-25Get rid of hashkeys field of Hash plan node, since it's redundant withTom Lane
the hashclauses field of the parent HashJoin. This avoids problems with duplicated links to SubPlans in hash clauses, as per report from Andrew Holm-Hansen.
2003-11-12Cross-data-type comparisons are now indexable by btrees, pursuant to myTom Lane
pghackers proposal of 8-Nov. All the existing cross-type comparison operators (int2/int4/int8 and float4/float8) have appropriate support. The original proposal of storing the right-hand-side datatype as part of the primary key for pg_amop and pg_amproc got modified a bit in the event; it is easier to store zero as the 'default' case and only store a nonzero when the operator is actually cross-type. Along the way, remove the long-since-defunct bigbox_ops operator class.
2003-11-09Add operator strategy and comparison-value datatype fields to ScanKey.Tom Lane
Remove the 'strategy map' code, which was a large amount of mechanism that no longer had any use except reverse-mapping from procedure OID to strategy number. Passing the strategy number to the index AM in the first place is simpler and faster. This is a preliminary step in planned support for cross-datatype index operations. I'm committing it now since the ScanKeyEntryInitialize() API change touches quite a lot of files, and I want to commit those changes before the tree drifts under me.
2003-11-06Implement isolation levels read uncommitted and repeatable read as actingPeter Eisentraut
like the next higher one.
2003-10-13Back out makeNode() patch to fix gcc 3.3.1 warning.Bruce Momjian
2003-10-12Use makeNode() to allocate structures that have to be cast to Node *,Bruce Momjian
rather than allocating them on the stack. Fixes complaint from gcc 3.3.1.
2003-10-11Back out -fstrict-aliasing void* casting.Bruce Momjian
2003-10-11This patch will stop gcc from issuing warnings about type-punned objectsBruce Momjian
when -fstrict-aliasing is turned on, as it is in the latest gcc when you use -O2 Andrew Dunstan
2003-10-01Repair RI trigger visibility problems (this time for sure ;-)) per recentTom Lane
discussion on pgsql-hackers: in READ COMMITTED mode we just have to force a QuerySnapshot update in the trigger, but in SERIALIZABLE mode we have to run the scan under a current snapshot and then complain if any rows would be updated/deleted that are not visible in the transaction snapshot.
2003-09-29I discovered that TupleDescGetAttInMetadata and BuildTupleFromCStringsBruce Momjian
don't deal well with tuples having dropped columns. The attached fixes the issue. Please apply. Joe Conway
2003-09-26Fix tid scan evaluation of non-constant TID values; can't try to do itTom Lane
during ExecInitTidScan, because the rest of the executor isn't ready.
2003-09-25Make the world safe (more or less) for dropped columns in plpgsql rowtypes.Tom Lane
2003-09-25tlist_matches_tupdesc() needs to defend itself against dropped columns.Tom Lane
2003-09-25Get rid of ReferentialIntegritySnapshotOverride by extending Executor APITom Lane
to allow es_snapshot to be set to SnapshotNow rather than a query snapshot. This solves a bug reported by Wade Klaver, wherein triggers fired as a result of RI cascade updates could misbehave.
2003-09-25Message editing: remove gratuitous variations in message wording, standardizePeter Eisentraut
terms, add some clarifications, fix some untranslatable attempts at dynamic message building.
2003-09-24Repair some REINDEX problems per recent discussions. The relcache isTom Lane
now able to cope with assigning new relfilenode values to nailed-in-cache indexes, so they can be reindexed using the fully crash-safe method. This leaves only shared system indexes as special cases. Remove the 'index deactivation' code, since it provides no useful protection in the shared- index case. Require reindexing of shared indexes to be done in standalone mode, but remove other restrictions on REINDEX. -P (IgnoreSystemIndexes) now prevents using indexes for lookups, but does not disable index updates. It is therefore safe to allow from PGOPTIONS. Upshot: reindexing system catalogs can be done without a standalone backend for all cases except shared catalogs.