summaryrefslogtreecommitdiff
path: root/src/backend/executor
Commit message (Collapse)AuthorAgeFilesLines
* Fix tid scan evaluation of non-constant TID values; can't try to do itTom Lane2003-09-261-34/+47
| | | | during ExecInitTidScan, because the rest of the executor isn't ready.
* Make the world safe (more or less) for dropped columns in plpgsql rowtypes.Tom Lane2003-09-252-41/+62
|
* tlist_matches_tupdesc() needs to defend itself against dropped columns.Tom Lane2003-09-251-4/+4
|
* Get rid of ReferentialIntegritySnapshotOverride by extending Executor APITom Lane2003-09-256-25/+69
| | | | | | 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.
* Message editing: remove gratuitous variations in message wording, standardizePeter Eisentraut2003-09-257-37/+37
| | | | | terms, add some clarifications, fix some untranslatable attempts at dynamic message building.
* Repair some REINDEX problems per recent discussions. The relcache isTom Lane2003-09-242-12/+3
| | | | | | | | | | | | | 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.
* _SPI_cursor_operation forgot to check for failure return fromTom Lane2003-09-231-4/+9
| | | | _SPI_begin_call. Per gripe from Tomasz Myrta.
* Since SPI_modifytuple's natts argument is the number of attributes to beTom Lane2003-09-161-2/+2
| | | | changed, it should allow a zero value (implying no changes to make).
* Fix LISTEN/NOTIFY race condition reported by Gavin Sherry. While aTom Lane2003-09-151-3/+5
| | | | | | | | | | | | | | | really general fix might be difficult, I believe the only case where AtCommit_Notify could see an uncommitted tuple is where the other guy has just unlistened and not yet committed. The best solution seems to be to just skip updating that tuple, on the assumption that the other guy does not want to hear about the notification anyway. This is not perfect --- if the other guy rolls back his unlisten instead of committing, then he really should have gotten this notify. But to do that, we'd have to wait to see if he commits or not, or make UNLISTEN hold exclusive lock on pg_listener until commit. Either of these answers is deadlock-prone, not to mention horrible for interactive performance. Do it this way for now. (What happened to that project to do LISTEN/NOTIFY in memory with no table, anyway?)
* OK, some of these syntax errors should be given other codes.Peter Eisentraut2003-09-152-8/+8
|
* Some "feature not supported" errors are better syntax errors, because thePeter Eisentraut2003-09-092-8/+8
| | | | | feature they complain about isn't a feature or cannot be implemented without definitional changes.
* Tweak processing of multiple-index-scan plans to reduce overhead whenTom Lane2003-08-221-30/+148
| | | | | | | handling many-way scans: instead of re-evaluating all prior indexscan quals to see if a tuple has been fetched more than once, use a hash table indexed by tuple CTID. But fall back to the old way if the hash table grows to exceed SortMem.
* Improve dynahash.c's API so that caller can specify the comparison functionTom Lane2003-08-193-84/+138
| | | | | | | | | | | | | as well as the hash function (formerly the comparison function was hardwired as memcmp()). This makes it possible to eliminate the special-purpose hashtable management code in execGrouping.c in favor of using dynahash to manage tuple hashtables; which is a win because dynahash knows how to expand a hashtable when the original size estimate was too small, whereas the special-purpose code was too stupid to do that. (See recent gripe from Stephan Szabo about poor performance when hash table size estimate is way off.) Free side benefit: when using string_hash, the default comparison function is now strncmp() instead of memcmp(). This should eliminate some part of the overhead associated with larger NAMEDATALEN values.
* Fix ARRAY[] construct so that in multidimensional case, elements canTom Lane2003-08-171-9/+24
| | | | | | | | be anything yielding an array of the proper kind, not only sub-ARRAY[] constructs; do subscript checking at runtime not parse time. Also, adjust array_cat to make array || array comply with the SQL99 spec. Joe Conway
* Code cleanup inspired by recent resname bug report (doesn't fix the bugTom Lane2003-08-111-8/+4
| | | | | | | | yet, though). Avoid using nth() to fetch tlist entries; provide a common routine get_tle_by_resno() to search a tlist for a particular resno. This replaces a couple uses of nth() and a dozen hand-coded search loops. Also, replace a few uses of nth(length-1, list) with llast().
* Another pgindent run with updated typedefs.Bruce Momjian2003-08-0815-114/+115
|
* Fix nasty little order-of-operations bug in _SPI_cursor_operation.Tom Lane2003-08-081-6/+17
| | | | Per report from Mendola Gaetano.
* Suppress unused-variable warnings when building without Asserts.Tom Lane2003-08-081-1/+3
|
* Rename fields of DestReceiver to avoid collisions with (ill-considered)Tom Lane2003-08-063-10/+10
| | | | macros in some platforms' sys/socket.h.
* Fix some copyright notices that weren't updated. Improve copyright toolTom Lane2003-08-041-2/+2
| | | | so it won't miss 'em again.
* Update copyrights to 2003.Bruce Momjian2003-08-0431-62/+62
|
* pgindent run.Bruce Momjian2003-08-0425-659/+696
|
* Adjust 'permission denied' messages to be more useful and consistent.Tom Lane2003-08-013-8/+12
|
* Cause ARRAY[] construct to return a NULL array, rather than raising anTom Lane2003-07-301-7/+13
| | | | | | error, if any input element is NULL. This is not what we ultimately want, but until arrays can have NULL elements, it will have to do. Patch from Joe Conway.
* Add error stack traceback support for SQL-language functions.Tom Lane2003-07-281-6/+80
|
* A visit from the message-style police ...Tom Lane2003-07-283-10/+10
|
* Error message editing in backend/executor.Tom Lane2003-07-2119-233/+330
|
* Aggregates can be polymorphic, using polymorphic implementation functions.Tom Lane2003-07-011-24/+53
| | | | | | It also works to create a non-polymorphic aggregate from polymorphic functions, should you want to do that. Regression test added, docs still lacking. By Joe Conway, with some kibitzing from Tom Lane.
* SQL functions can have arguments and results declared ANYARRAY orTom Lane2003-07-011-14/+54
| | | | | | | | ANYELEMENT. The effect is to postpone typechecking of the function body until runtime. Documentation is still lacking. Original patch by Joe Conway, modified to postpone type checking by Tom Lane.
* Support expressions of the form 'scalar op ANY (array)' andTom Lane2003-06-291-2/+162
| | | | | | | | | | 'scalar op ALL (array)', where the operator is applied between the lefthand scalar and each element of the array. The operator must yield boolean; the result of the construct is the OR or AND of the per-element results, respectively. Original coding by Joe Conway, after an idea of Peter's. Rewritten by Tom to keep the implementation strictly separate from subqueries.
* Create real array comparison functions (that use the element datatype'sTom Lane2003-06-272-125/+5
| | | | | | | | | | | | | | | | comparison functions), replacing the highly bogus bitwise array_eq. Create a btree index opclass for ANYARRAY --- it is now possible to create indexes on array columns. Arrange to cache the results of catalog lookups across multiple array operations, instead of repeating the lookups on every call. Add string_to_array and array_to_string functions. Remove singleton_array, array_accum, array_assign, and array_subscript functions, since these were for proof-of-concept and not intended to become supported functions. Minor adjustments to behavior in some corner cases with empty or zero-dimensional arrays. Joe Conway (with some editorializing by Tom Lane).
* Back out array mega-patch.Bruce Momjian2003-06-253-487/+242
| | | | Joe Conway
* Array mega-patch.Bruce Momjian2003-06-243-242/+487
| | | | Joe Conway
* Revise hash join and hash aggregation code to use the same datatype-Tom Lane2003-06-225-100/+116
| | | | | | | | specific hash functions used by hash indexes, rather than the old not-datatype-aware ComputeHashFunc routine. This makes it safe to do hash joining on several datatypes that previously couldn't use hashing. The sets of datatypes that are hash indexable and hash joinable are now exactly the same, whereas before each had some that weren't in the other.
* Replace cryptic 'Unknown kind of return type' messages with somethingTom Lane2003-06-151-2/+5
| | | | hopefully a little more useful.
* Fix SQL function executor for case where last command of a function isTom Lane2003-06-121-8/+10
| | | | not a SELECT. We didn't use to allow that, but we do now.
* Implement outer-level aggregates to conform to the SQL spec, withTom Lane2003-06-062-3/+8
| | | | | | | | extensions to support our historical behavior. An aggregate belongs to the closest query level of any of the variables in its argument, or the current query level if there are no variables (e.g., COUNT(*)). The implementation involves adding an agglevelsup field to Aggref, and treating outer aggregates like outer variables at planning time.
* Small performance improvement for hash joins and hash aggregation:Tom Lane2003-05-302-40/+76
| | | | | | | when the plan is ReScanned, we don't have to rebuild the hash table if there is no parameter change for its child node. This idea has been used for a long time in Sort and Material nodes, but was not in the hash code till now.
* Fix some planner performance problems with large WHERE clauses, byTom Lane2003-05-281-15/+19
| | | | | | | introducing new 'FastList' list-construction subroutines to use in hot spots. This avoids the O(N^2) behavior of repeated lappend's by keeping a tail pointer, while not changing behavior by reversing list order as the lcons() method would do.
* Replace functional-index facility with expressional indexes. Any columnTom Lane2003-05-281-7/+6
| | | | | | | | | | | of an index can now be a computed expression instead of a simple variable. Restrictions on expressions are the same as for predicates (only immutable functions, no sub-selects). This fixes problems recently introduced with inlining SQL functions, because the inlining transformation is applied to both expression trees so the planner can still match them up. Along the way, improve efficiency of handling index predicates (both predicates and index expressions are now cached by the relcache) and fix 7.3 oversight that didn't record dependencies of predicate expressions.
* Make debug_ GUC varables output DEBUG1 rather than LOG, and mention inBruce Momjian2003-05-271-2/+2
| | | | | docs that CLIENT/LOG_MIN_MESSAGES now controls debug_* output location. Doc changes included.
* Implement new-protocol binary I/O support in DataRow, Bind, and FunctionCallTom Lane2003-05-091-6/+2
| | | | | messages. Binary I/O is now up and working, but only for a small set of datatypes (integers, text, bytea).
* Update 3.0 protocol support to match recent agreements about how toTom Lane2003-05-085-23/+17
| | | | | | | handle multiple 'formats' for data I/O. Restructure CommandDest and DestReceiver stuff one more time (it's finally starting to look a bit clean though). Code now matches latest 3.0 protocol document as far as message formats go --- but there is no support for binary I/O yet.
* Restructure command destination handling so that we pass aroundTom Lane2003-05-065-88/+125
| | | | | | | | | | | | | | DestReceiver pointers instead of just CommandDest values. The DestReceiver is made at the point where the destination is selected, rather than deep inside the executor. This cleans up the original kluge implementation of tstoreReceiver.c, and makes it easy to support retrieving results from utility statements inside portals. Thus, you can now do fun things like Bind and Execute a FETCH or EXPLAIN command, and it'll all work as expected (e.g., you can Describe the portal, or use Execute's count parameter to suspend the output partway through). Implementation involves stuffing the utility command's output into a Tuplestore, which would be kind of annoying for huge output sets, but should be quite acceptable for typical uses of utility commands.
* Implement feature of new FE/BE protocol whereby RowDescription identifiesTom Lane2003-05-066-88/+37
| | | | | | | | | the column by table OID and column number, if it's a simple column reference. Along the way, get rid of reskey/reskeyop fields in Resdoms. Turns out that representation was not convenient for either the planner or the executor; we can make the planner deliver exactly what the executor wants with no more effort. initdb forced due to change in stored rule representation.
* Ditch ExecGetTupType() in favor of the much simpler ExecGetResultType(),Tom Lane2003-05-057-204/+20
| | | | | | which does the same thing. Perhaps at one time there was a reason to allow plan nodes to store their result types in different places, but AFAICT that's been unnecessary for a good while.
* Portal and memory management infrastructure for extended query protocol.Tom Lane2003-05-023-163/+86
| | | | | | | | | Both plannable queries and utility commands are now always executed within Portals, which have been revamped so that they can handle the load (they used to be good only for single SELECT queries). Restructure code to push command-completion-tag selection logic out of postgres.c, so that it won't have to be duplicated between simple and extended queries. initdb forced due to addition of a field to Query nodes.
* Infrastructure for deducing Param types from context, in the same wayTom Lane2003-04-291-3/+3
| | | | | | | | | | | that the types of untyped string-literal constants are deduced (ie, when coerce_type is applied to 'em, that's what the type must be). Remove the ancient hack of storing the input Param-types array as a global variable, and put the info into ParseState instead. This touches a lot of files because of adjustment of routine parameter lists, but it's really not a large patch. Note: PREPARE statement still insists on exact specification of parameter types, but that could easily be relaxed now, if we wanted to do so.
* Code review for holdable-cursors patch. Fix error recovery, memoryTom Lane2003-04-292-5/+15
| | | | | context sloppiness, some other things. Includes Neil's mopup patch of 22-Apr.
* Put back encoding-conversion step in processing of incoming queries;Tom Lane2003-04-271-6/+2
| | | | | | | | | | I had inadvertently omitted it while rearranging things to support length-counted incoming messages. Also, change the parser's API back to accepting a 'char *' query string instead of 'StringInfo', as the latter wasn't buying us anything except overhead. (I think when I put it in I had some notion of making the parser API 8-bit-clean, but seeing that flex depends on null-terminated input, that's not really ever gonna happen.)