summaryrefslogtreecommitdiff
path: root/src/backend/tcop/pquery.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix SPI cursor support to allow scanning the results of utility commandsTom Lane2005-02-101-2/+27
| | | | | | that return tuples (such as EXPLAIN). Per gripe from Michael Fuhr. Side effect: fix an old bug that unintentionally disabled backward scans for all SPI-created cursors.
* Fix a bug induced by the list-rewrite that resulted in incrementing theNeil Conway2005-02-011-2/+2
| | | | command counter more than necessary. Per report from Michael Fuhr.
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-311-2/+2
| | | | | | | | Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
* PortalRun must guard against the possibility that the portal it'sTom Lane2004-10-041-7/+35
| | | | | | | | | | | | | | running contains VACUUM or a similar command that will internally start and commit transactions. In such a case, the original caller values of CurrentMemoryContext and CurrentResourceOwner will point to objects that will be destroyed by the internal commit. We must restore these pointers to point to the newly-manufactured transaction context and resource owner, rather than possibly pointing to deleted memory. Also tweak xact.c so that AbortTransaction and AbortSubTransaction forcibly restore a sane value for CurrentResourceOwner, much as they have always done for CurrentMemoryContext. I'm not certain this is necessary but I'm feeling paranoid today. Responds to Sean Chittenden's bug report of 4-Oct.
* Redesign query-snapshot timing so that volatile functions in READ COMMITTEDTom Lane2004-09-131-21/+72
| | | | | | | | | | | | | mode see a fresh snapshot for each command in the function, rather than using the latest interactive command's snapshot. Also, suppress fresh snapshots as well as CommandCounterIncrement inside STABLE and IMMUTABLE functions, instead using the snapshot taken for the most closely nested regular query. (This behavior is only sane for read-only functions, so the patch also enforces that such functions contain only SELECT commands.) As per my proposal of 6-Sep-2004; I note that I floated essentially the same proposal on 19-Jun-2002, but that discussion tailed off without any action. Since 8.0 seems like the right place to be taking possibly nontrivial backwards compatibility hits, let's get it done now.
* Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane2004-09-101-3/+19
| | | | | | | | | | | | | rather than when returning to the idle loop. This makes no particular difference for interactively-issued queries, but it makes a big difference for queries issued within functions: trigger execution now occurs before the calling function is allowed to proceed. This responds to numerous complaints about nonintuitive behavior of foreign key checking, such as http://archives.postgresql.org/pgsql-bugs/2004-09/msg00020.php, and appears to be required by the SQL99 spec. Also take the opportunity to simplify the data structures used for the pending-trigger list, rename them for more clarity, and squeeze out a bit of space.
* Pgindent run for 8.0.Bruce Momjian2004-08-291-16/+19
|
* Update copyright to 2004.Bruce Momjian2004-08-291-2/+2
|
* Allow DECLARE CURSOR to take parameters from the portal in which it isTom Lane2004-08-021-3/+3
| | | | | | | | | | executed. Previously, the DECLARE would succeed but subsequent FETCHes would fail since the parameter values supplied to DECLARE were not propagated to the portal created for the cursor. In support of this, add type Oids to ParamListInfo entries, which seems like a good idea anyway since code that extracts a value can double-check that it got the type of value it was expecting. Oliver Jowett, with minor editorialization by Tom Lane.
* Restructure error handling as recently discussed. It is now reallyTom Lane2004-07-311-149/+199
| | | | | | possible to trap an error inside a function rather than letting it propagate out to PostgresMain. You still have to use AbortCurrentTransaction to clean up, but at least the error handling itself will cooperate.
* Invent ResourceOwner mechanism as per my recent proposal, and use it toTom Lane2004-07-171-26/+45
| | | | | | | | keep track of portal-related resources separately from transaction-related resources. This allows cursors to work in a somewhat sane fashion with nested transactions. For now, cursor behavior is non-subtransactional, that is a cursor's state does not roll back if you abort a subtransaction that fetched from the cursor. We might want to change that later.
* Tweak palloc/repalloc to allow zero bytes to be requested, as per recentTom Lane2004-06-051-3/+2
| | | | | proposal. Eliminate several dozen now-unnecessary hacks to avoid palloc(0). (It's likely there are more that I didn't find.)
* Use new forboth() macro to make loop coding a bit clearer.Tom Lane2004-05-261-5/+4
|
* Reimplement the linked list data structure used throughout the backend.Neil Conway2004-05-261-12/+13
| | | | | | | | | | | | | | | | 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.
* Revise syntax-error reporting behavior to give pleasant results forTom Lane2004-03-211-1/+16
| | | | | errors in internally-generated queries, such as those submitted by plpgsql functions. Per recent discussions with Fabien Coelho.
* Fix log_executor_stats if() test.Bruce Momjian2004-03-181-6/+3
|
* Fix log_executor_stats for non-multi queries. Backpatch to 7.4.X.Bruce Momjian2004-03-051-1/+15
|
* $Header: -> $PostgreSQL Changes ...PostgreSQL Daemon2003-11-291-1/+1
|
* Get rid of ReferentialIntegritySnapshotOverride by extending Executor APITom Lane2003-09-251-3/+3
| | | | | | 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.
* Change some frequently-reached elog(DEBUG...) calls to ereport(DEBUG...)Tom Lane2003-08-121-3/+5
| | | | | for speed reasons. (ereport falls out much more quickly when no output is needed than elog does.)
* Rename fields of DestReceiver to avoid collisions with (ill-considered)Tom Lane2003-08-061-4/+4
| | | | macros in some platforms' sys/socket.h.
* Update copyrights to 2003.Bruce Momjian2003-08-041-2/+2
|
* pgindent run.Bruce Momjian2003-08-041-108/+121
|
* Fix inconsistent static-vs-not-static declarations.Tom Lane2003-08-011-2/+2
|
* Error message editing in backend/libpq, backend/postmaster, backend/tcop.Tom Lane2003-07-221-12/+25
| | | | | Along the way, fix some logic problems in pgstat_initstats, notably the bogus assumption that malloc returns zeroed memory.
* Replace functional-index facility with expressional indexes. Any columnTom Lane2003-05-281-3/+4
| | | | | | | | | | | 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-3/+3
| | | | | docs that CLIENT/LOG_MIN_MESSAGES now controls debug_* output location. Doc changes included.
* Update 3.0 protocol support to match recent agreements about how toTom Lane2003-05-081-26/+56
| | | | | | | 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.
* Ensure that an Execute operation can't send tuples in cases whereTom Lane2003-05-061-1/+18
| | | | | | | Describe would claim that no tuples will be returned. Only affects SELECTs added to non-SELECT base queries by rewrite rules. If you want to see the output of such a select, you gotta use 'simple Query' protocol.
* Restructure command destination handling so that we pass aroundTom Lane2003-05-061-67/+97
| | | | | | | | | | | | | | 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-061-4/+12
| | | | | | | | | 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.
* Portal and memory management infrastructure for extended query protocol.Tom Lane2003-05-021-5/+901
| | | | | | | | | 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.
* Restructure parsetree representation of DECLARE CURSOR: now it's aTom Lane2003-03-101-95/+6
| | | | | | | | | | | | utility statement (DeclareCursorStmt) with a SELECT query dangling from it, rather than a SELECT query with a few unusual fields in it. Add code to determine whether a planned query can safely be run backwards. If DECLARE CURSOR specifies SCROLL, ensure that the plan can be run backwards by adding a Materialize plan node if it can't. Without SCROLL, you get an error if you try to fetch backwards from a cursor that can't handle it. (There is still some discussion about what the exact behavior should be, but this is necessary infrastructure in any case.) Along the way, make EXPLAIN DECLARE CURSOR work.
* Revise executor APIs so that all per-query state structure is built inTom Lane2002-12-151-4/+17
| | | | | | a per-query memory context created by CreateExecutorState --- and destroyed by FreeExecutorState. This provides a final solution to the longstanding problem of memory leaked by various ExecEndNode calls.
* Phase 1 of read-only-plans project: cause executor state nodes to pointTom Lane2002-12-051-73/+25
| | | | | | | | | | to plan nodes, not vice-versa. All executor state nodes now inherit from struct PlanState. Copying of plan trees has been simplified by not storing a list of SubPlans in Plan nodes (eliminating duplicate links). The executor still needs such a list, but it can build it during ExecutorStart since it has to scan the plan tree anyway. No initdb forced since no stored-on-disk structures changed, but you will need a full recompile because of node-numbering changes.
* Put back error test for DECLARE CURSOR outside a transaction block ...Tom Lane2002-11-181-1/+3
| | | | but do it correctly now.
* pgindent run.Bruce Momjian2002-09-041-7/+8
|
* Update copyright to 2002.Bruce Momjian2002-06-201-2/+2
|
* Revise command completion tags as per hackers message on 20 March.Peter Eisentraut2002-05-181-2/+2
|
* The contents of command.c, creatinh.c, define.c, remove.c and rename.cTom Lane2002-04-151-2/+2
| | | | | | | | | | | | | | | have been divided according to the type of object manipulated - so ALTER TABLE code is in tablecmds.c, aggregate commands in aggregatecmds.c and so on. A few common support routines remain in define.c (prototypes in src/include/commands/defrem.h). No code has been changed except for includes to reflect the new files. The prototypes for aggregatecmds.c, functioncmds.c, operatorcmds.c, and typecmds.c remain in src/include/commands/defrem.h. From John Gray <jgray@azuli.co.uk>
* First phase of SCHEMA changes, concentrating on fixing the grammar andTom Lane2002-03-211-3/+3
| | | | | | | | the parsetree representation. As yet we don't *do* anything with schema names, just drop 'em on the floor; but you can enter schema-compatible command syntax, and there's even a primitive CREATE SCHEMA command. No doc updates yet, except to note that you can now extract a field from a function-returning-row's result with (foo(...)).fieldname.
* Change made to elog:Bruce Momjian2002-03-061-2/+2
| | | | | | | | | | | | | | | | | | | o Change all current CVS messages of NOTICE to WARNING. We were going to do this just before 7.3 beta but it has to be done now, as you will see below. o Change current INFO messages that should be controlled by client_min_messages to NOTICE. o Force remaining INFO messages, like from EXPLAIN, VACUUM VERBOSE, etc. to always go to the client. o Remove INFO from the client_min_messages options and add NOTICE. Seems we do need three non-ERROR elog levels to handle the various behaviors we need for these messages. Regression passed.
* Paranoia about data structure lifetime ...Tom Lane2002-02-271-2/+3
|
* Clean up BeginCommand and related routines. BeginCommand and EndCommandTom Lane2002-02-271-41/+20
| | | | | | | | | | | are now both invoked once per received SQL command (raw parsetree) from pg_exec_query_string. BeginCommand is actually just an empty routine at the moment --- all its former operations have been pushed into tuple receiver setup routines in printtup.c. This makes for a clean distinction between BeginCommand/EndCommand (once per command) and the tuple receiver setup/teardown routines (once per ExecutorRun call), whereas the old code was quite ad hoc. Along the way, clean up the calling conventions for ExecutorRun a little bit.
* Restructure command-completion-report code so that there is just oneTom Lane2002-02-261-59/+51
| | | | | | | report for each received SQL command, regardless of rewriting activity. Also ensure that this report comes from the 'original' command, not the last command generated by rewrite; this fixes 7.2 breakage for INSERT commands that have actions added by rules. Fernando Nasser and Tom Lane.
* pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian2001-10-251-4/+2
| | | | tests pass.
* Further cleanup of dynahash.c API, in pursuit of portability andTom Lane2001-10-051-2/+2
| | | | | | | | | readability. Bizarre '(long *) TRUE' return convention is gone, in favor of just raising an error internally in dynahash.c when we detect hashtable corruption. HashTableWalk is gone, in favor of using hash_seq_search directly, since it had no hope of working with non-LONGALIGNable datatypes. Simplify some other code that was made undesirably grotty by promixity to HashTableWalk.
* Remove dashes in comments that don't need them, rewrap with pgindent.Bruce Momjian2001-03-221-58/+41
|
* pgindent run. Make it all clean.Bruce Momjian2001-03-221-2/+7
|
* Tweak portal (cursor) code so that it will not call the executor againTom Lane2001-02-271-2/+2
| | | | | | | | | | | when user does another FETCH after reaching end of data, or another FETCH backwards after reaching start. This is needed because some plan nodes are not very robust about being called again after they've already returned NULL; for example, MergeJoin will crash in some states but not others. While the ideal approach would be for them all to handle this correctly, it seems foolish to assume that no such bugs would creep in again once cleaned up. Therefore, the most robust answer is to prevent the situation from arising at all.