PostgreSQL
File History
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

History of files named src/backend/commands/prepare.c

2014-05-06
16:12
[734117c653] part of check-in [8a34b23fd1] pgindent run for 9.4 This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching. (user: bruce@momjian.us branch: trunk)
2014-01-29
21:09
[8b65f1eab5] part of check-in [e986d97a48] Include planning time in EXPLAIN ANALYZE output. This doesn't work for prepared queries, but it's not too easy to get the information in that case and there's some debate as to exactly what the right thing to measure is, so just do this for now. Andreas Karlsson, with slight doc changes by me. (user: rhaas@postgresql.org branch: trunk)
2014-01-07
21:05
[64042e5a29] part of check-in [07693ed4c5] Update copyright for 2014 Update all files in head, and files COPYRIGHT and legal.sgml in all back branches. (user: bruce@momjian.us branch: trunk)
2013-03-04
00:23
[6770dd7cb6] part of check-in [926b6ba9e8] Add a materialized view relations. A materialized view has a rule just like a view and a heap and other physical properties like a table. The rule is only used to populate the table, references in queries refer to the materialized data. This is a minimal implementation, but should still be useful in many cases. Currently data is only populated "on demand" by the CREATE MATERIALIZED VIEW and REFRESH MATERIALIZED VIEW statements. It is expected that future releases will add incremental updates with various timings, and that a more refined concept of defining what is "fresh" data will be developed. At some point it may even be possible to have queries use a materialized in place of references to underlying tables, but that requires the other above-mentioned features to be working first. Much of the documentation work by Robert Haas. Review by Noah Misch, Thom Brown, Robert Haas, Marko Tiikkaja Security review by KaiGai Kohei, with a decision on how best to implement sepgsql still pending. (user: kgrittn@postgresql.org branch: REL9_0_ALPHA4_BRANCH)
2013-01-01
22:15
[059f569e62] part of check-in [33819a70f9] Update copyrights for 2013 Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files. (user: bruce@momjian.us branch: REL9_0_ALPHA4_BRANCH)
2012-11-26
20:55
[c48c3a845e] part of check-in [6268b1d625] Revert patch for taking fewer snapshots. This reverts commit d573e239f03506920938bf0be56c868d9c3416da, "Take fewer snapshots". While that seemed like a good idea at the time, it caused execution to use a snapshot that had been acquired before locking any of the tables mentioned in the query. This created user-visible anomalies that were not present in any prior release of Postgres, as reported by Tomas Vondra. While this whole area could do with a redesign (since there are related cases that have anomalies anyway), it doesn't seem likely that any future patch would be reasonably back-patchable; and we don't want 9.2 to exhibit a behavior that's subtly unlike either past or future releases. Hence, revert to prior code while we rethink the problem. (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
20:55
[69c65dd443] part of check-in [b74a588c1a] Revert patch for taking fewer snapshots. This reverts commit d573e239f03506920938bf0be56c868d9c3416da, "Take fewer snapshots". While that seemed like a good idea at the time, it caused execution to use a snapshot that had been acquired before locking any of the tables mentioned in the query. This created user-visible anomalies that were not present in any prior release of Postgres, as reported by Tomas Vondra. While this whole area could do with a redesign (since there are related cases that have anomalies anyway), it doesn't seem likely that any future patch would be reasonably back-patchable; and we don't want 9.2 to exhibit a behavior that's subtly unlike either past or future releases. Hence, revert to prior code while we rethink the problem. (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
2012-08-10
15:36
[5f40765c0f] part of check-in [9370a517a6] Centralize the logic for detecting misplaced aggregates, window funcs, etc. Formerly we relied on checking after-the-fact to see if an expression contained aggregates, window functions, or sub-selects when it shouldn't. This is grotty, easily forgotten (indeed, we had forgotten to teach DefineIndex about rejecting window functions), and none too efficient since it requires extra traversals of the parse tree. To improve matters, define an enum type that classifies all SQL sub-expressions, store it in ParseState to show what kind of expression we are currently parsing, and make transformAggregateCall, transformWindowFuncCall, and transformSubLink check the expression type and throw error if the type indicates the construct is disallowed. This allows removal of a large number of ad-hoc checks scattered around the code base. The enum type is sufficiently fine-grained that we can still produce error messages of at least the same specificity as before. Bringing these error checks together revealed that we'd been none too consistent about phrasing of the error messages, so standardize the wording a bit. Also, rewrite checking of aggregate arguments so that it requires only one traversal of the arguments, rather than up to three as before. In passing, clean up some more comments left over from add_missing_from support, and annotate some tests that I think are dead code now that that's gone. (I didn't risk actually removing said dead code, though.) (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
2012-06-10
19:20
[afb1ccb693] part of check-in [628cc3faf5] Run pgindent on 9.2 source tree in preparation for first 9.3 commit-fest. (user: bruce@momjian.us branch: REL9_0_ALPHA4_BRANCH)
2012-03-20
01:38
[ed63b98da3] part of check-in [bdcaccd37b] Restructure SELECT INTO's parsetree representation into CreateTableAsStmt. Making this operation look like a utility statement seems generally a good idea, and particularly so in light of the desire to provide command triggers for utility statements. The original choice of representing it as SELECT with an IntoClause appendage had metastasized into rather a lot of places, unfortunately, so that this patch is a great deal more complicated than one might at first expect. In particular, keeping EXPLAIN working for SELECT INTO and CREATE TABLE AS subcommands required restructuring some EXPLAIN-related APIs. Add-on code that calls ExplainOnePlan or ExplainOneUtility, or uses ExplainOneQuery_hook, will need adjustment. Also, the cases PREPARE ... SELECT INTO and CREATE RULE ... SELECT INTO, which formerly were accepted though undocumented, are no longer accepted. The PREPARE case can be replaced with use of CREATE TABLE AS EXECUTE. The CREATE RULE case doesn't seem to have much real-world use (since the rule would work only once before failing with "table already exists"), so we'll not bother with that one. Both SELECT INTO and CREATE TABLE AS still return a command tag of "SELECT nnnn". There was some discussion of returning "CREATE TABLE nnnn", but for the moment backwards compatibility wins the day. Andres Freund and Tom Lane (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
2012-01-01
23:01
[5ab8b9b551] part of check-in [8ca5d56b07] Update copyright notices for year 2012. (user: bruce@momjian.us branch: REL9_0_ALPHA4_BRANCH)
2011-12-21
14:16
[6a2ab8a6dd] part of check-in [1515c51a16] Take fewer snapshots. When a PORTAL_ONE_SELECT query is executed, we can opportunistically reuse the parse/plan shot for the execution phase. This cuts down the number of snapshots per simple query from 2 to 1 for the simple protocol, and 3 to 2 for the extended protocol. Since we are only reusing a snapshot taken early in the processing of the same protocol message, the change shouldn't be user-visible, except that the remote possibility of the planning and execution snapshots being different is eliminated. Note that this change does not make it safe to assume that the parse/plan snapshot will certainly be reused; that will currently only happen if PortalStart() decides to use the PORTAL_ONE_SELECT strategy. It might be worth trying to provide some stronger guarantees here in the future, but for now we don't. Patch by me; review by Dimitri Fontaine. (user: rhaas@postgresql.org branch: REL9_0_ALPHA4_BRANCH)
2011-09-16
04:43
[ef85e77d28] part of check-in [fc6b94c7d5] Redesign the plancache mechanism for more flexibility and efficiency. Rewrite plancache.c so that a "cached plan" (which is rather a misnomer at this point) can support generation of custom, parameter-value-dependent plans, and can make an intelligent choice between using custom plans and the traditional generic-plan approach. The specific choice algorithm implemented here can probably be improved in future, but this commit is all about getting the mechanism in place, not the policy. In addition, restructure the API to greatly reduce the amount of extraneous data copying needed. The main compromise needed to make that possible was to split the initial creation of a CachedPlanSource into two steps. It's worth noting in particular that SPI_saveplan is now deprecated in favor of SPI_keepplan, which accomplishes the same end result with zero data copying, and no need to then spend even more cycles throwing away the original SPIPlan. The risk of long-term memory leaks while manipulating SPIPlans has also been greatly reduced. Most of this improvement is based on use of the recently-added MemoryContextSetParent primitive. (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
2011-09-09
17:23
[47a5ab9320] part of check-in [7bad543fde] Move Timestamp/Interval typedefs and basic macros into datatype/timestamp.h. As per my recent proposal, this refactors things so that these typedefs and macros are available in a header that can be included in frontend-ish code. I also changed various headers that were undesirably including utils/timestamp.h to include datatype/timestamp.h instead. Unsurprisingly, this showed that half the system was getting utils/timestamp.h by way of xlog.h. No actual code changes here, just header refactoring. (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
2011-09-01
14:04
[35c7aad93d] part of check-in [0a686317c3] Remove unnecessary #include references, per pgrminclude script. (user: bruce@momjian.us branch: REL9_0_ALPHA4_BRANCH)
2011-04-10
15:42
[5f8d141557] part of check-in [24958ed74a] pgindent run before PG 9.1 beta 1. (user: bruce@momjian.us branch: REL9_0_ALPHA4_BRANCH)
2011-03-20
00:30
[302892ac5d] part of check-in [d8cdcb0f15] Revise collation derivation method and expression-tree representation. All expression nodes now have an explicit output-collation field, unless they are known to only return a noncollatable data type (such as boolean or record). Also, nodes that can invoke collation-aware functions store a separate field that is the collation value to pass to the function. This avoids confusion that arises when a function has collatable inputs and noncollatable output type, or vice versa. Also, replace the parser's on-the-fly collation assignment method with a post-pass over the completed expression tree. This allows us to use a more complex (and hopefully more nearly spec-compliant) assignment rule without paying for it in extra storage in every expression node. Fix assorted bugs in the planner's handling of collations by making collation one of the defining properties of an EquivalenceClass and by converting CollateExprs into discardable RelabelType nodes during expression preprocessing. (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
2011-01-01
18:18
[77945809e5] part of check-in [d1e9a3478d] Stamp copyrights for year 2011. (user: bruce@momjian.us branch: REL9_0_ALPHA4_BRANCH)
2010-10-25
18:44
[602d4c8a01] part of check-in [d65ae8556b] Refactor typenameTypeId() Split the old typenameTypeId() into two functions: A new typenameTypeId() that returns only a type OID, and typenameTypeIdAndMod() that returns type OID and typmod. This isolates call sites better that actually care about the typmod. (user: peter_e@gmx.net branch: REL9_0_ALPHA4_BRANCH)
2010-09-20
20:08
[37700740be] part of check-in [df1941270e] Remove cvs keywords from all files. (user: magnus@hagander.net branch: REL9_0_ALPHA4_BRANCH)
2010-01-02
16:58
[02fc40ab79] part of check-in [d6888d3d5f] Update copyright for the year 2010. (user: bruce@momjian.us branch: REL9_0_ALPHA4_BRANCH)
2009-12-29
17:41
[8604853aab] part of check-in [2124689ef8] Previous fix for temporary file management broke returning a set from PL/pgSQL function within an exception handler. Make sure we use the right resource owner when we create the tuplestore to hold returned tuples. Simplify tuplestore API so that the caller doesn't need to be in the right memory context when calling tuplestore_put* functions. tuplestore.c automatically switches to the memory context used when the tuplestore was created. Tuplesort was already modified like this earlier. This patch also removes the now useless MemoryContextSwitch calls from callers. Report by Aleksei on pgsql-bugs on Dec 22 2009. Backpatch to 8.1, like the previous patch that broke this. (user: heikki.linnakangas@iki.fi branch: WIN32_DEV)
17:41
[9c8c1ff7a8] part of check-in [92374699f8] Previous fix for temporary file management broke returning a set from PL/pgSQL function within an exception handler. Make sure we use the right resource owner when we create the tuplestore to hold returned tuples. Simplify tuplestore API so that the caller doesn't need to be in the right memory context when calling tuplestore_put* functions. tuplestore.c automatically switches to the memory context used when the tuplestore was created. Tuplesort was already modified like this earlier. This patch also removes the now useless MemoryContextSwitch calls from callers. Report by Aleksei on pgsql-bugs on Dec 22 2009. Backpatch to 8.1, like the previous patch that broke this. (user: heikki.linnakangas@iki.fi branch: WIN32_DEV)
17:41
[03877399d6] part of check-in [769b54ce6a] Previous fix for temporary file management broke returning a set from PL/pgSQL function within an exception handler. Make sure we use the right resource owner when we create the tuplestore to hold returned tuples. Simplify tuplestore API so that the caller doesn't need to be in the right memory context when calling tuplestore_put* functions. tuplestore.c automatically switches to the memory context used when the tuplestore was created. Tuplesort was already modified like this earlier. This patch also removes the now useless MemoryContextSwitch calls from callers. Report by Aleksei on pgsql-bugs on Dec 22 2009. Backpatch to 8.1, like the previous patch that broke this. (user: heikki.linnakangas@iki.fi branch: WIN32_DEV)
17:40
[a3d2154f2d] part of check-in [74652980124777f] Previous fix for temporary file management broke returning a set from PL/pgSQL function within an exception handler. Make sure we use the right resource owner when we create the tuplestore to hold returned tuples. Simplify tuplestore API so that the caller doesn't need to be in the right memory context when calling tuplestore_put* functions. tuplestore.c automatically switches to the memory context used when the tuplestore was created. Tuplesort was already modified like this earlier. This patch also removes the now useless MemoryContextSwitch calls from callers. Report by Aleksei on pgsql-bugs on Dec 22 2009. Backpatch to 8.1, like the previous patch that broke this. (user: heikki.linnakangas@iki.fi branch: REL9_0_ALPHA4_BRANCH)
2009-11-04
22:26
[998c02972b] part of check-in [a41a961e5c] Add support for invoking parser callback hooks via SPI and in cached plans. As proof of concept, modify plpgsql to use the hooks. plpgsql is still inserting $n symbols textually, but the "back end" of the parsing process now goes through the ParamRef hook instead of using a fixed parameter-type array, and then execution only fetches actually-referenced parameters, using a hook added to ParamListInfo. Although there's a lot left to be done in plpgsql, this already cures the "if (TG_OP = 'INSERT' and NEW.foo ...)" problem, as illustrated by the changed regression test. (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
2009-08-10
05:46
[a5b49ad2ee] part of check-in [4299283d36] Extend EXPLAIN to support output in XML or JSON format. There are probably still some adjustments to be made in the details of the output, but this gets the basic structure in place. Robert Haas (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
2009-07-26
23:34
[36b2b78259] part of check-in [d564c89084] Extend EXPLAIN to allow generic options to be specified. The original syntax made it difficult to add options without making them into reserved words. This change parenthesizes the options to avoid that problem, and makes provision for an explicit (and perhaps non-Boolean) value for each option. The original syntax is still supported, but only for the two original options ANALYZE and VERBOSE. As a test case, add a COSTS option that can suppress the planner cost estimates. This may be useful for including EXPLAIN output in the regression tests, which are otherwise unable to cope with cross-platform variations in cost estimates. Robert Haas (user: tgl@sss.pgh.pa.us branch: REL9_0_ALPHA4_BRANCH)
2009-06-11
14:49
[12f65ad0a1] part of check-in [4807c89da5] 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list provided by Andrew. (user: bruce@momjian.us branch: WIN32_DEV)
2009-01-02
20:42
[d60ecb93b5] part of check-in [6d348b46ae] Include a pointer to the query's source text in QueryDesc structs. This is practically free given prior 8.4 changes in plancache and portal management, and it makes it a lot easier for ExecutorStart/Run/End hooks to get at the query text. Extracted from Itagaki Takahiro's pg_stat_statements patch, with minor editorialization. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2009-01-01
17:24
[22404900ca] part of check-in [a08fd82be5] Update copyright for 2009. (user: bruce@momjian.us branch: WIN32_DEV)
2008-12-28
18:54
[8db4bc8daa] part of check-in [d74ee927c0] Support window functions a la SQL:2008. Hitoshi Harada, with some kibitzing from Heikki and Tom. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2008-12-13
02:29
[a832a24d38] part of check-in [cfa3cfc3fb] Remove pg_plan_queries()'s now-useless needSnapshot parameter. It's useless in 8.3, too, but I'm not back-patching this change since it would break any extension modules that might be calling that function. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2008-10-29
00:00
[c50739b049] part of check-in [ca9b66a792] Be more tense about not creating tuplestores with randomAccess = true unless backwards scan could actually happen. In particular, pass a flag to materialize-mode SRFs that tells them whether they need to require random access. In passing, also suppress unneeded backward-scan overhead for a Portal's holdStore tuplestore. Per my proposal about reducing I/O costs for tuplestores. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2008-08-28
23:09
[f4dd52ea76] part of check-in [ed35af5b20] Extend the parser location infrastructure to include a location field in most node types used in expression trees (both before and after parse analysis). This allows us to place an error cursor in many situations where we formerly could not, because the information wasn't available beyond the very first level of parse analysis. There's a fair amount of work still to be done to persuade individual ereport() calls to actually include an error location, but this gets the initdb-forcing part of the work out of the way; and the situation is already markedly better than before for complaints about unimplementable implicit casts, such as CASE and UNION constructs with incompatible alternative data types. Per my proposal of a few days ago. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2008-08-25
22:42
[bce2f26216] part of check-in [b5f4ff1b0f] Move exprType(), exprTypmod(), expression_tree_walker(), and related routines into nodes/nodeFuncs, so as to reduce wanton cross-subsystem #includes inside the backend. There's probably more that should be done along this line, but this is a start anyway. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2008-07-21
15:26
[f0b35d477d] part of check-in [91e3aea3f9] Add comment about the two different query strings that ExecuteQuery() has to deal with. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2008-07-18
20:26
[c707416b51] part of check-in [9fffb6d684] Adjust things so that the query_string of a cached plan and the sourceText of a portal are never NULL, but reliably provide the source text of the query. It turns out that there was only one place that was really taking a short-cut, which was the 'EXECUTE' utility statement. That doesn't seem like a sufficiently critical performance hotspot to justify not offering a guarantee of validity of the portal source text. Fix it to copy the source text over from the cached plan. Add Asserts in the places that set up cached plans and portals to reject null source strings, and simplify a bunch of places that formerly needed to guard against nulls. There may be a few places that cons up statements for execution without having any source text at all; I found one such in ConvertTriggerToFK(). It seems sufficient to inject a phony source string in such a case, for instance ProcessUtility((Node *) atstmt, "(generated ALTER TABLE ADD FOREIGN KEY command)", NULL, false, None_Receiver, NULL); We should take a second look at the usage of debug_query_string, particularly the recently added current_query() SQL function. ITAGAKI Takahiro and Tom Lane (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2008-05-12
20:02
[69427710711181a] part of check-in [d86aac1610] Improve snapshot manager by keeping explicit track of snapshots. There are two ways to track a snapshot: there's the "registered" list, which is used for arbitrary long-lived snapshots; and there's the "active stack", which is used for the snapshot that is considered "active" at any time. This also allows users of snapshots to stop worrying about snapshot memory allocation and freeing, and about using PG_TRY blocks around ActiveSnapshot assignment. This is all done automatically now. As a consequence, this allows us to reset MyProc->xmin when there are no more snapshots registered in the current backend, reducing the impact that long-running transactions have on VACUUM. (user: alvherre@alvh.no-ip.org branch: WIN32_DEV)
00:00
[3b1d6f2349] part of check-in [3c881f8264] Restructure some header files a bit, in particular heapam.h, by removing some unnecessary #include lines in it. Also, move some tuple routine prototypes and macros to htup.h, which allows removal of heapam.h inclusion from some .c files. For this to work, a new header file access/sysattr.h needed to be created, initially containing attribute numbers of system columns, for pg_dump usage. While at it, make contrib ltree, intarray and hstore header files more consistent with our header style. (user: alvherre@alvh.no-ip.org branch: WIN32_DEV)
2008-04-02
18:32
[77151f3494] part of check-in [3f66e95fb5] Revert my bad decision of about a year ago to make PortalDefineQuery responsible for copying the query string into the new Portal. Such copying is unnecessary in the common code path through exec_simple_query, and in this case it can be enormously expensive because the string might contain a large number of individual commands; we were copying the entire, long string for each command, resulting in O(N^2) behavior for N commands. (This is the cause of bug #4079.) A second problem with it is that PortalDefineQuery really can't risk error, because if it elog's before having set up the Portal, we will leak the plancache refcount that the caller is trying to hand off to the portal. So go back to the design in which the caller is responsible for making sure everything is copied into the portal if necessary. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
18:31
[563c4837d6] part of check-in [2c2fb4f258] Revert my bad decision of about a year ago to make PortalDefineQuery responsible for copying the query string into the new Portal. Such copying is unnecessary in the common code path through exec_simple_query, and in this case it can be enormously expensive because the string might contain a large number of individual commands; we were copying the entire, long string for each command, resulting in O(N^2) behavior for N commands. (This is the cause of bug #4079.) A second problem with it is that PortalDefineQuery really can't risk error, because if it elog's before having set up the Portal, we will leak the plancache refcount that the caller is trying to hand off to the portal. So go back to the design in which the caller is responsible for making sure everything is copied into the portal if necessary. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2008-03-26
18:48
[2466ba3d18] part of check-in [f1b9f9e97a] Rename snapmgmt.c/h to snapmgr.c/h, for consistency with other files. Per complaint from Tom Lane. (user: alvherre@alvh.no-ip.org branch: WIN32_DEV)
16:20
[6c3652648d] part of check-in [c42f943a7d] Separate snapshot management code from tuple visibility code, create a snapmgmt.c file for the former. The header files have also been reorganized in three parts: the most basic snapshot definitions are now in a new file snapshot.h, and the also new snapmgmt.h keeps the definitions for snapmgmt.c. tqual.h has been reduced to the bare minimum. This patch is just a first step towards managing live snapshots within a transaction; there is no functionality change. Per my proposal to pgsql-patches on 20080318191940.GB27458@alvh.no-ip.org and subsequent discussion. (user: alvherre@alvh.no-ip.org branch: WIN32_DEV)
2008-03-25
22:42
[34ae257343] part of check-in [a74914d876] Simplify and standardize conversions between TEXT datums and ordinary C strings. This patch introduces four support functions cstring_to_text, cstring_to_text_with_len, text_to_cstring, and text_to_cstring_buffer, and two macros CStringGetTextDatum and TextDatumGetCString. A number of existing macros that provided variants on these themes were removed. Most of the places that need to make such conversions now require just one function or macro call, in place of the multiple notational layers that used to be needed. There are no longer any direct calls of textout or textin, and we got most of the places that were using handmade conversions via memcpy (there may be a few still lurking, though). This commit doesn't make any serious effort to eliminate transient memory leaks caused by detoasting toasted text objects before they reach text_to_cstring. We changed PG_GETARG_TEXT_P to PG_GETARG_TEXT_PP in a few places where it was easy, but much more could be done. Brendan Jurd and Tom Lane (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
19:26
[d2bd497bb7] part of check-in [fd8c004ca3] Add a new tuplestore API function, tuplestore_putvalues(). This is identical to tuplestore_puttuple(), except it operates on arrays of Datums + nulls rather than a fully-formed HeapTuple. In several places that use the tuplestore API, this means we can avoid creating a HeapTuple altogether, saving a copy. (user: neilc@samurai.com branch: WIN32_DEV)
2008-01-01
19:46
[6b1fd4c9fb] part of check-in [82dd97eab1] Update copyrights in source tree to 2008. (user: bruce@momjian.us branch: WIN32_DEV)
2007-11-15
21:14
[a464db567e] part of check-in [4804e015b4] pgindent run for 8.3. (user: bruce@momjian.us branch: WIN32_DEV)
2007-11-11
19:22
[35d1582d34] part of check-in [97b5e72ae6] Ensure that typmod decoration on a datatype name is validated in all cases, even in code paths where we don't pay any subsequent attention to the typmod value. This seems needed in view of the fact that 8.3's generalized typmod support will accept a lot of bogus syntax, such as "timestamp(foo)" or "record(int, 42)" --- if we allow such things to pass without comment, users will get confused. Per a recent example from Greg Stark. To implement this in a way that's not very vulnerable to future bugs-of-omission, refactor the API of parse_type.c's TypeName lookup routines so that typmod validation is folded into the base lookup operation. Callers can still choose not to receive the encoded typmod, but we'll check the decoration anyway if it's present. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2007-06-23
22:12
[87814dc76a] part of check-in [f8eeb7a11c] Separate parse-analysis for utility commands out of parser/analyze.c (which now deals only in optimizable statements), and put that code into a new file parser/parse_utilcmd.c. This helps clarify and enforce the design rule that utility statements shouldn't be processed during the regular parse analysis phase; all interpretation of their meaning should happen after they are given to ProcessUtility to execute. (We need this because we don't retain any locks for a utility statement that's in a plan cache, nor have any way to detect that it's stale.) We are also able to simplify the API for parse_analyze() and related routines, because they will now always return exactly one Query structure. In passing, fix bug #3403 concerning trying to add a serial column to an existing temp table (this is largely Heikki's work, but we needed all that restructuring to make it safe). (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2007-05-25
17:54
[565dc8bbdf] part of check-in [7f70afca5e] Create hooks to let a loadable plugin monitor (or even replace) the planner and/or create plans for hypothetical situations; in particular, investigate plans that would be generated using hypothetical indexes. This is a heavily-rewritten version of the hooks proposed by Gurjeet Singh for his Index Advisor project. In this formulation, the index advisor can be entirely a loadable module instead of requiring a significant part to be in the core backend, and plans can be generated for hypothetical indexes without requiring the creation and rolling-back of system catalog entries. The index advisor patch as-submitted is not compatible with these hooks, but it needs significant work anyway due to other 8.2-to-8.3 planner changes. With these hooks in the core backend, development of the advisor can proceed as a pgfoundry project. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2007-04-27
22:05
[dccf1b233e] part of check-in [26b0314d17] Modify processing of DECLARE CURSOR and EXPLAIN so that they can resolve the types of unspecified parameters when submitted via extended query protocol. This worked in 8.2 but I had broken it during plancache changes. DECLARE CURSOR is now treated almost exactly like a plain SELECT through parse analysis, rewrite, and planning; only just before sending to the executor do we divert it away to ProcessUtility. This requires a special-case check in a number of places, but practically all of them were already special-casing SELECT INTO, so it's not too ugly. (Maybe it would be a good idea to merge the two by treating IntoClause as a form of utility statement? Not going to worry about that now, though.) That approach doesn't work for EXPLAIN, however, so for that I punted and used a klugy solution of running parse analysis an extra time if under extended query protocol. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2007-04-26
23:24
[7987a13bfc] part of check-in [e69ec47ef7] Fix dynahash.c to suppress hash bucket splits while a hash_seq_search() scan is in progress on the same hashtable. This seems the least invasive way to fix the recently-recognized problem that a split could cause the scan to visit entries twice or (with much lower probability) miss them entirely. The only field-reported problem caused by this is the "failed to re-find shared lock object" PANIC in COMMIT PREPARED reported by Michel Dorochevsky, which was caused by multiply visited entries. However, it seems certain that mdsync() is vulnerable to missing required fsync's due to missed entries, and I am fearful that RelationCacheInitializePhase2() might be at risk as well. Because of that and the generalized hazard presented by this bug, back-patch all the supported branches. Along the way, fix pg_prepared_statement() and pg_cursor() to not assume that the hashtables they are examining will stay static between calls. This is risky regardless of the newly noted dynahash problem, because hash_seq_search() has never promised to cope with deletion of table entries other than the just-returned one. There may be no bug here because the only supported way to call these functions is via ExecMakeTableFunctionResult() which will cycle them to completion before doing anything very interesting, but it seems best to get rid of the assumption. This affects 8.2 and HEAD only, since those functions weren't there earlier. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
23:24
[532e149a9e] part of check-in [a4beb08960] Fix dynahash.c to suppress hash bucket splits while a hash_seq_search() scan is in progress on the same hashtable. This seems the least invasive way to fix the recently-recognized problem that a split could cause the scan to visit entries twice or (with much lower probability) miss them entirely. The only field-reported problem caused by this is the "failed to re-find shared lock object" PANIC in COMMIT PREPARED reported by Michel Dorochevsky, which was caused by multiply visited entries. However, it seems certain that mdsync() is vulnerable to missing required fsync's due to missed entries, and I am fearful that RelationCacheInitializePhase2() might be at risk as well. Because of that and the generalized hazard presented by this bug, back-patch all the supported branches. Along the way, fix pg_prepared_statement() and pg_cursor() to not assume that the hashtables they are examining will stay static between calls. This is risky regardless of the newly noted dynahash problem, because hash_seq_search() has never promised to cope with deletion of table entries other than the just-returned one. There may be no bug here because the only supported way to call these functions is via ExecMakeTableFunctionResult() which will cycle them to completion before doing anything very interesting, but it seems best to get rid of the assumption. This affects 8.2 and HEAD only, since those functions weren't there earlier. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2007-04-16
18:21
[434eca11cc] part of check-in [7ddb1750bd] Make plancache store cursor options so it can pass them to planner during a replan. I had originally thought this was not necessary, but the new SPI facilities create a path whereby queries planned with non-default options can get into the cache, so it is necessary. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
01:14
[f6ad081ca1] part of check-in [fa6ce87a37] Expose more cursor-related functionality in SPI: specifically, allow access to the planner's cursor-related planning options, and provide new FETCH/MOVE routines that allow access to the full power of those commands. Small refactoring of planner(), pg_plan_query(), and pg_plan_queries() APIs to make it convenient to pass the planning options down from SPI. This is the core-code portion of Pavel Stehule's patch for scrollable cursor support in plpgsql; I'll review and apply the plpgsql changes separately. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2007-04-12
06:53
[842dd0cc0a] part of check-in [05124b7bf5] RESET SESSION, plus related new DDL commands. Patch from Marko Kreen, reviewed by Neil Conway. This patch adds the following DDL command variants: RESET SESSION, RESET TEMP, RESET PLANS, CLOSE ALL, and DEALLOCATE ALL. RESET SESSION is intended for use by connection pool software and the like, in order to reset a client session to something close to its initial state. Note that while most of these command variants can be executed inside a transaction block (but are not transaction-aware!), RESET SESSION cannot. While this is inconsistent, it is intended to catch programmer mistakes: RESET SESSION in an open transaction block is probably unintended. (user: neilc@samurai.com branch: WIN32_DEV)
2007-03-13
00:33
[bb0e3859ae] part of check-in [5492cc02af] First phase of plan-invalidation project: create a plan cache management module and teach PREPARE and protocol-level prepared statements to use it. In service of this, rearrange utility-statement processing so that parse analysis does not assume table schemas can't change before execution for utility statements (necessary because we don't attempt to re-acquire locks for utility statements when reusing a stored plan). This requires some refactoring of the ProcessUtility API, but it ends up cleaner anyway, for instance we can get rid of the QueryContext global. Still to do: fix up SPI and related code to use the plan cache; I'm tempted to try to make SQL functions use it too. Also, there are at least some aspects of system state that we want to ensure remain the same during a replan as in the original processing; search_path certainly ought to behave that way for instance, and perhaps there are others. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2007-02-20
17:32
[ad30cebdb2] part of check-in [dc1326853e] Remove the Query structure from the executor's API. This allows us to stop storing mostly-redundant Query trees in prepared statements, portals, etc. To replace Query, a new node type called PlannedStmt is inserted by the planner at the top of a completed plan tree; this carries just the fields of Query that are still needed at runtime. The statement lists kept in portals etc. now consist of intermixed PlannedStmt and bare utility-statement nodes --- no Query. This incidentally allows us to remove some fields from Query and Plan nodes that shouldn't have been there in the first place. Still to do: simplify the execution-time range table; at the moment the range table passed to the executor still contains Query trees for subqueries. initdb forced due to change of stored rules. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2007-01-28
19:05
[5559b95ce0] part of check-in [0d6bf9848a] Remove some unnecessary conversion work in build_regtype_array(). (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2007-01-05
22:20
[689215e217] part of check-in [b001d7ced8] Update CVS HEAD for 2007 copyright. Back branches are typically not back-stamped for this. (user: bruce@momjian.us branch: WIN32_DEV)
2006-10-04
00:30
[2d952d4837] part of check-in [3bc88654c2] pgindent run for 8.2. (user: bruce@momjian.us branch: WIN32_DEV)
2006-09-27
18:40
[6c2bbd045e] part of check-in [3cd3b0a944] Replace strncpy with strlcpy in selected places that seem possibly relevant to performance. (A wholesale effort to get rid of strncpy should be undertaken sometime, but not during beta.) This commit also fixes dynahash.c to correctly truncate overlength string keys for hashtables, so that its callers don't have to anymore. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2006-09-07
22:52
[838ffa2cc6] part of check-in [d38af04357] Clean up logging for extended-query-protocol operations, as per my recent proposal. Parameter logging works even for binary-format parameters, and logging overhead is avoided when disabled. log_statement = all output for the src/test/examples/testlibpq3.c example now looks like LOG: statement: execute <unnamed>: SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: statement: execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' and log_min_duration_statement = 0 results in LOG: duration: 2.431 ms parse <unnamed>: SELECT * FROM test1 WHERE t = $1 LOG: duration: 2.335 ms bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: duration: 0.394 ms execute <unnamed>: SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: duration: 1.251 ms parse <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 LOG: duration: 0.566 ms bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' LOG: duration: 0.173 ms execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' (This example demonstrates the folly of ignoring parse/bind steps for duration logging purposes, BTW.) Along the way, create a less ad-hoc mechanism for determining which commands are logged by log_statement = mod and log_statement = ddl. The former coding was actually missing quite a few things that look like ddl to me, and it did not handle EXECUTE or extended query protocol correctly at all. This commit does not do anything about the question of whether log_duration should be removed or made less redundant with log_min_duration_statement. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2006-09-06
20:40
[60547c401b] part of check-in [feb8158042] Change processing of extended-Query mode so that an unnamed statement that has parameters is always planned afresh for each Bind command, treating the parameter values as constants in the planner. This removes the performance penalty formerly often paid for using out-of-line parameters --- with this definition, the planner can do constant folding, LIKE optimization, etc. After a suggestion by Andrew@supernews. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2006-08-29
02:11
[e1eb31379d] part of check-in [2e6aa2ad98] Now bind displays prepare as detail, and execute displays prepare and optionally bind. I re-added the "statement:" label so people will understand why the line is being printed (it is log_*statement behavior). Use single quotes for bind values, instead of double quotes, and double literal single quotes in bind values (and document that). I also made use of the DETAIL line to have much cleaner output. (user: bruce@momjian.us branch: WIN32_DEV)
2006-08-14
22:57
[2d5b94d07d] part of check-in [67c234695a] Fix oversight in initial implementation of PORTAL_ONE_RETURNING mode: we cannot assume that there's exactly one Query in the Portal, as we can for ONE_SELECT mode, because non-SELECT queries might have extra queries added during rule rewrites. Fix things up so that we'll use ONE_RETURNING mode when a Portal contains one primary (canSetTag) query and that query has a RETURNING list. This appears to be a second showstopper reason for running the Portal to completion before we start to hand anything back --- we want to be sure that the rule-added queries get run too. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2006-08-12
02:52
[99a10ec509] part of check-in [0c39507170] Add INSERT/UPDATE/DELETE RETURNING, with basic docs and regression tests. plpgsql support to come later. Along the way, convert execMain's SELECT INTO support into a DestReceiver, in order to eliminate some ugly special cases. Jonah Harris and Tom Lane (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2006-08-08
01:23
[965b6797e2] part of check-in [80cca8e65b] For protocol-level prepare/bind/execute: o print user name for all o print portal name if defined for all o print query for all o reduce log_statement header to single keyword o print bind parameters as DETAIL if text mode (user: bruce@momjian.us branch: WIN32_DEV)
2006-07-14
14:52
[3de8c749f2] part of check-in [268bedfd50] Remove 576 references of include files that were not needed. (user: bruce@momjian.us branch: WIN32_DEV)
2006-07-13
16:49
[e2e8bfddcf] part of check-in [3227cc926c] Allow include files to compile own their own. Strip unused include files out unused include files, and add needed includes to C files. The next step is to remove unused include files in C files. (user: bruce@momjian.us branch: WIN32_DEV)
2006-07-11
17:26
[9f6c9aceec] part of check-in [01ca7353e4] Alphabetically order reference to include files, "N" - "S". (user: bruce@momjian.us branch: WIN32_DEV)
2006-07-03
22:45
[a39f8ba9bd] part of check-in [fec0275059] Code review for FILLFACTOR patch. Change WITH grammar as per earlier discussion (including making def_arg allow reserved words), add missed opt_definition for UNIQUE case. Put the reloptions support code in a less random place (I chose to make a new file access/common/reloptions.c). Eliminate header inclusion creep. Make the index options functions safely user-callable (seems like client apps might like to be able to test validity of options before trying to make an index). Reduce overhead for normal case with no options by allowing rd_options to be NULL. Fix some unmaintainably klugy code, including getting rid of Natts_pg_class_fixed at long last. Some stylistic cleanup too, and pay attention to keeping comments in sync with code. Documentation still needs work, though I did fix the omissions in catalogs.sgml and indexam.sgml. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2006-07-02
02:23
[d82aad4d0c] part of check-in [a9d79dd32d] Add FILLFACTOR to CREATE INDEX. ITAGAKI Takahiro (user: bruce@momjian.us branch: WIN32_DEV)
2006-06-20
22:52
[75d5646ab1] part of check-in [320892bdc3] Remove redundant gettimeofday() calls to the extent practical without changing semantics too much. statement_timestamp is now set immediately upon receipt of a client command message, and the various places that used to do their own gettimeofday() calls to mark command startup are referenced to that instead. I have also made stats_command_string use that same value for pg_stat_activity.query_start for both the command itself and its eventual replacement by <IDLE> or <idle in transaction>. There was some debate about that, but no argument that seemed convincing enough to justify an extra gettimeofday() call. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2006-04-25
14:11
[7eab155aba] part of check-in [c37e242964] Back out RESET CONNECTION until there is more discussion. (user: bruce@momjian.us branch: WIN32_DEV)
14:09
[befea5e8c1] part of check-in [1f4c383ae3] Add RESET CONNECTION, to reset all aspects of a session. Hans-J?rgen Sch?nig (user: bruce@momjian.us branch: WIN32_DEV)
2006-04-22
01:26
[b601aa3831] part of check-in [5d2a3e0d27] Simplify ParamListInfo data structure to support only numbered parameters, not named ones, and replace linear searches of the list with array indexing. The named-parameter support has been dead code for many years anyway, and recent profiling suggests that the searching was costing a noticeable amount of performance for complex queries. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2006-03-05
15:59
[e0849d448e] part of check-in [5c3bc0e952] Update copyright for 2006. Update scripts. (user: bruce@momjian.us branch: WIN32_DEV)
2006-02-19
00:04
[f74158c406] part of check-in [016df06eab] Add TABLESPACE and ON COMMIT clauses to CREATE TABLE AS. ON COMMIT is required by the SQL standard, and TABLESPACE is useful functionality. Patch from Kris Jurka, minor editorialization by Neil Conway. (user: neilc@samurai.com branch: WIN32_DEV)
2006-01-18
06:49
[034ca223d7] part of check-in [83a388b4b1] Add a new system view, pg_cursors, that displays the currently available cursors. Patch from Joachim Wieland, review and ediorialization by Neil Conway. The view lists cursors defined by DECLARE CURSOR, using SPI, or via the Bind message of the frontend/backend protocol. This means the view does not list the unnamed portal or the portal created to implement EXECUTE. Because we do list SPI portals, there might be more rows in this view than you might expect if you are using SPI implicitly (e.g. via a procedural language). Per recent discussion on -hackers, the query string included in the view for cursors defined by DECLARE CURSOR is based on debug_query_string. That means it is not accurate if multiple queries separated by semicolons are submitted as one query string. However, there doesn't seem a trivial fix for that: debug_query_string is better than nothing. I also changed SPI_cursor_open() to include the source text for the portal it creates: AFAICS there is no reason not to do this. Update the documentation and regression tests, bump the catversion. (user: neilc@samurai.com branch: WIN32_DEV)
2006-01-16
18:15
[de4ce27557] part of check-in [63425ade38] Change the parameter_types column of the pg_prepared_statements to be an array of regtype, rather than an array of OIDs. This is likely to be more useful to user, and the type OID can easily be obtained by casting a regtype value to OID. Per suggestion from Tom. Update the documentation and regression tests, and bump the catversion. (user: neilc@samurai.com branch: WIN32_DEV)
2006-01-08
07:00
[60c59c2666] part of check-in [4981948351b] Add a new system view, pg_prepared_statements, that can be used to access information about the prepared statements that are available in the current session. Original patch from Joachim Wieland, various improvements by Neil Conway. The "statement" column of the view contains the literal query string sent by the client, without any rewriting or pretty printing. This means that prepared statements created via SQL will be prefixed with "PREPARE ... AS ", whereas those prepared via the FE/BE protocol will not. That is unfortunate, but discussion on -patches did not yield an efficient way to improve this, and there is some merit in returning exactly what the client sent to the backend. Catalog version bumped, regression tests updated. (user: neilc@samurai.com branch: WIN32_DEV)
2005-12-14
17:07
[0bd55a99f2] part of check-in [a8f190fcf0] Defend against crash while processing Describe Statement or Describe Portal messages, when client attempts to execute these outside a transaction (start one) or in a failed transaction (reject message, except for COMMIT/ROLLBACK statements which we can handle). Per report from Francisco Figueiredo Jr. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
17:06
[9af8d52e86] part of check-in [8b93042e78] Defend against crash while processing Describe Statement or Describe Portal messages, when client attempts to execute these outside a transaction (start one) or in a failed transaction (reject message, except for COMMIT/ROLLBACK statements which we can handle). Per report from Francisco Figueiredo Jr. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
17:06
[1a29268341] part of check-in [00db558d24] Defend against crash while processing Describe Statement or Describe Portal messages, when client attempts to execute these outside a transaction (start one) or in a failed transaction (reject message, except for COMMIT/ROLLBACK statements which we can handle). Per report from Francisco Figueiredo Jr. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
17:06
[3c1a8b677a] part of check-in [fd3bc14c52] Defend against crash while processing Describe Statement or Describe Portal messages, when client attempts to execute these outside a transaction (start one) or in a failed transaction (reject message, except for COMMIT/ROLLBACK statements which we can handle). Per report from Francisco Figueiredo Jr. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2005-11-29
01:25
[e13335948c] part of check-in [374e7d9fe9] Fix EXPLAIN and EXECUTE commands to pass portal parameters through to the executor. This allows, for example, JDBC clients to use '?' bound parameters in these commands. Per gripe from Virag Saksena. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2005-10-21
16:43
[827e637293] part of check-in [9dbd4e2926] Fix EXPLAIN ANALYZE bug noted by Wiebe Cazemier: although we were properly advancing the CommandCounter between multiple sub-queries generated by rules, we forgot to update the snapshot being used, so that the successive sub-queries didn't actually see each others' results. This is still not *exactly* like the semantics of normal execution of the same queries, in that we don't take new transaction snapshots and hence don't see changes from concurrently committed commands, but I think that's OK and probably even preferable for EXPLAIN ANALYZE. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2005-10-15
02:49
[6998dbe1fa] part of check-in [d9fa7ffb42] Standard pgindent run for 8.1. (user: bruce@momjian.us branch: WIN32_DEV)
2005-06-22
17:45
[e1c6d87a8a] part of check-in [d5c2f1613a] Fix the mechanism for reporting the original table OID and column number of columns of a query result so that it can "see through" cursors and prepared statements. Per gripe a couple months back from John DeSoi. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2005-06-03
23:05
[2c4d310d15] part of check-in [fd555fa93d] Revise handling of dropped columns in JOIN alias lists to avoid a performance problem pointed out by phil@vodafone: to wit, we were spending O(N^2) time to check dropped-ness in an N-deep join tree, even in the case where the tree was freshly constructed and couldn't possibly mention any dropped columns. Instead of recursing in get_rte_attribute_is_dropped(), change the data structure definition: the joinaliasvars list of a JOIN RTE must have a NULL Const instead of a Var at any position that references a now-dropped column. This costs nothing during normal parse-rewrite-plan path, and instead we have a linear-time update to make when loading a stored rule that might contain now-dropped columns. While at it, move the responsibility for acquring locks on relations referenced by rules into this separate function (which I therefore chose to call AcquireRewriteLocks). This saves effort --- namely, duplicated lock grabs in parser and rewriter --- in the normal path at a cost of one extra non-locked heap_open() in the stored-rule path; seems a good tradeoff. A fringe benefit is that it is now *much* clearer that we acquire lock on relations referenced in rules before we make any rewriter decisions based on their properties. (I don't know of any bug of that ilk, but it wasn't exactly clear before.) (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2005-05-29
04:23
[36dde202e2] part of check-in [029eaebba4] Modify hash_search() API to prevent future occurrences of the error spotted by Qingqing Zhou. The HASH_ENTER action now automatically fails with elog(ERROR) on out-of-memory --- which incidentally lets us eliminate duplicate error checks in quite a bunch of places. If you really need the old return-NULL-on-out-of-memory behavior, you can ask for HASH_ENTER_NULL. But there is now an Assert in that path checking that you aren't hoping to get that behavior in a palloc-based hash table. Along the way, remove the old HASH_FIND_SAVE/HASH_REMOVE_SAVED actions, which were not being used anywhere anymore, and were surely too ugly and unsafe to want to see revived again. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2005-05-24
04:18
[c30a1c34ea] part of check-in [b0858e9bb6] Log queries for client-side prepare/execute. Simon Riggs Log prepare query during execute. Bruce Momjian (user: bruce@momjian.us branch: WIN32_DEV)
2005-01-01
05:43
[54f2a7109a] part of check-in [5f6f9953c7] Update copyrights that were missed. (user: bruce@momjian.us branch: WIN32_DEV)
2004-12-13
00:17
[eec2a0852b] part of check-in [a4383352d9] Back-patch copyOject fix for EXPLAIN/PREPARE. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2004-12-12
20:17
[1eae4b27d7] part of check-in [7b0f5d5a93] PREPARE and EXPLAIN need to copy the source query just like we recently had to do in DECLARE CURSOR. AFAICS these are all the places affected. PREPARE case per example from Michael Fuhr, EXPLAIN case located by grepping for planner calls ... (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2004-12-03
21:26
[70b291a384] part of check-in [dfea7b5bc4] Use StrNCpy not strncpy to fill hash key, to ensure the resulting key is null-terminated. I think this is not a real bug because the parser would always have truncated the identifier to NAMEDATALEN-1 already, but let's be safe. Per report from Klocwork. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
21:26
[9be1647016] part of check-in [194ec94479] Use StrNCpy not strncpy to fill hash key, to ensure the resulting key is null-terminated. I think this is not a real bug because the parser would always have truncated the identifier to NAMEDATALEN-1 already, but let's be safe. Per report from Klocwork. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2004-10-25
00:46
[4d63f019cd] part of check-in [65a0504157] Modify hash_create() to elog(ERROR) if an error occurs, rather than returning a NULL pointer (some callers remembered to check the return value, but some did not -- it is safer to just bail out). Also, cleanup pgstat.c to use elog(ERROR) rather than elog(LOG) followed by exit(). (user: neilc@samurai.com branch: WIN32_DEV)
2004-09-13
20:10
[9a5bd9c262] part of check-in [6177bc87b2] Redesign query-snapshot timing so that volatile functions in READ COMMITTED 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. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2004-08-29
05:07
[4b056786d6] part of check-in [324c0e0bbe] Pgindent run for 8.0. (user: bruce@momjian.us branch: WIN32_DEV)
04:13
[e295b17171] part of check-in [f4b2d380e9] Update copyright to 2004. (user: bruce@momjian.us branch: WIN32_DEV)
2004-08-02
01:30
[d74d075f14] part of check-in [269415aefd] Allow DECLARE CURSOR to take parameters from the portal in which it is 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. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2004-06-11
01:09
[90d35d1310] part of check-in [1d7198da44] When using extended-query protocol, postpone planning of unnamed statements until Bind is received, so that actual parameter values are visible to the planner. Make use of the parameter values for estimation purposes (but don't fold them into the actual plan). This buys back most of the potential loss of plan quality that ensues from using out-of-line parameters instead of putting literal values right into the query text. This patch creates a notion of constant-folding expressions 'for estimation purposes only', in which case we can be more aggressive than the normal eval_const_expressions() logic can be. Right now the only difference in behavior is inserting bound values for Params, but it will be interesting to look at other possibilities. One that we've seen come up repeatedly is reducing now() and related functions to current values, so that queries like ... WHERE timestampcol > now() - '1 day' have some chance of being planned effectively. Oliver Jowett, with some kibitzing from Tom Lane. (user: tgl@sss.pgh.pa.us branch: WIN32_DEV)
2004-05-26
04:41
[b043ccc17d] part of check-in [1ca4325a5c] Reimplement the linked list data structure used throughout the backend. 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. (user: neilc@samurai.com branch: WIN32_DEV)
2004-04-22
02:58
[67c914cbb5] part of check-in [0821c52ea4] This patch makes the EXECUTE command's completion tag return the completion tag of the actual statement executed. This allows the correct update count to be returned for UPDATE/INSERT/DELETE statements. Kris Jurka (user: bruce@momjian.us branch: WIN32_DEV)
2004-01-07
18:56
[ae115540db] part of check-in [0c1d963866] More janitorial work: remove the explicit casting of NULL literals to a 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. (user: neilc@samurai.com branch: WIN32_DEV)
2003-11-29
19:52
[1099e2ff76] part of check-in [4faf317083] $Header: -> $PostgreSQL Changes ... (user: webmaster@postgresql.org branch: WIN32_DEV)
2003-08-08
21:42
[b19986d248] part of check-in [1319a835c9] Another pgindent run with updated typedefs. (user: bruce@momjian.us branch: WIN32_DEV)
2003-08-04
00:43
[9a1796d3a9] part of check-in [7c1c9e82e2] pgindent run. (user: bruce@momjian.us branch: trunk)
2003-07-28
00:09
[b5dc9fa461] part of check-in [58a7d0fd29] A visit from the message-style police ... (user: tgl@sss.pgh.pa.us branch: trunk)
2003-07-20
21:56
[e177c30431] part of check-in [4defeecae7] Another round of error message editing, covering backend/commands/. (user: tgl@sss.pgh.pa.us branch: trunk)
2003-07-01
00:04
[f30668315d] part of check-in [3a40c41e83] Change EXECUTE INTO to CREATE TABLE AS EXECUTE. (user: peter_e@gmx.net branch: trunk)
2003-05-08
18:16
[5277cc98de] part of check-in [0cad5fa037] Update 3.0 protocol support to match recent agreements about how to 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. (user: tgl@sss.pgh.pa.us branch: trunk)
2003-05-06
21:51
[5c7ff9bc0c] part of check-in [ce5fe3abe8] Add display of eventual result RowDescription (if any) to the output of Describe on a prepared statement. This was in the original 3.0 protocol proposal, but I took it out for reasons that seemed good at the time. Put it back per yesterday's pghackers discussion. (user: tgl@sss.pgh.pa.us branch: trunk)
20:26
[4a8e8cb5c1] part of check-in [ff72e0164a] Restructure command destination handling so that we pass around 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. (user: tgl@sss.pgh.pa.us branch: trunk)
2003-05-05
00:44
[91fd045f8f] part of check-in [13f7934191] Extended query protocol: parse, bind, execute, describe FE/BE messages. Only lightly tested as yet, since libpq doesn't know anything about 'em. (user: tgl@sss.pgh.pa.us branch: trunk)
2003-05-02
20:54
[78f7526c2e] part of check-in [6b1ce68237] Portal and memory management infrastructure for extended query protocol. 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. (user: tgl@sss.pgh.pa.us branch: trunk)
2003-02-02
23:46
[f759f44555] part of check-in [a591e28fa5] Implement EXPLAIN EXECUTE. By Neil Conway, with some kibitzing from Tom Lane. (user: tgl@sss.pgh.pa.us branch: trunk)
2002-12-15
21:01
[2352f71489] part of check-in [c5551cc6e5] Tweak default memory context allocation policy so that a context is not given any malloc block until something is first allocated in it; but thereafter, MemoryContextReset won't release that first malloc block. This preserves the quick-reset property of the original policy, without forcing 8K to be allocated to every context whether any of it is ever used or not. Also, remove some more no-longer-needed explicit freeing during ExecEndPlan. (user: tgl@sss.pgh.pa.us branch: trunk)
16:17
[44fe7d27f9] part of check-in [c3d8c02a90] Revise executor APIs so that all per-query state structure is built in 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. (user: tgl@sss.pgh.pa.us branch: trunk)
2002-12-13
19:46
[c2ae9e552a] part of check-in [9beb0ad46f] Phase 3 of read-only-plans project: ExecInitExpr now builds expression execution state trees, and ExecEvalExpr takes an expression state tree not an expression plan tree. The plan tree is now read-only as far as the executor is concerned. Next step is to begin actually exploiting this property. (user: tgl@sss.pgh.pa.us branch: trunk)
2002-12-05
15:50
[85bd274b4b] part of check-in [572e77b439] Phase 1 of read-only-plans project: cause executor state nodes to point 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. (user: tgl@sss.pgh.pa.us branch: trunk)
2002-11-15
00:47
[cefcb9786c] part of check-in [3484e06b84] Rename: ! #show_parser_stats = false ! #show_planner_stats = false ! #show_executor_stats = false ! #show_statement_stats = false TO: ! #log_parser_stats = false ! #log_planner_stats = false ! #log_executor_stats = false ! #log_statement_stats = false (user: bruce@momjian.us branch: trunk)
2002-11-13
00:39
[353f54922c] part of check-in [ca1233f475] Add new palloc0 call as merge of palloc and MemSet(0). (user: bruce@momjian.us branch: trunk)
2002-11-11
03:02
[0c7e661825] part of check-in [167ba685bd] Back out use of palloc0 in place if palloc/MemSet. Seems constant len to MemSet is a performance boost. (user: bruce@momjian.us branch: trunk)
2002-11-10
07:25
[96423cf13b] part of check-in [439ad57295] Merge palloc()/MemSet(0) calls into a single palloc0() call. (user: bruce@momjian.us branch: trunk)
2002-09-20
03:45
[56f4ce5754] part of check-in [afaae40603] > I'm not sure why NDirectFileRead/NDirectFileWrite are unused at the > moment, but they used to be used; I think the correct response is to > put back the missing counter increments, not rip out the counters. Ok, fair enough. It's worth noting that they've been broken for a while -- for example, the HashJoin counter increments were broken when you comitted r1.20 of executor/nodeHashJoin.c in May of '99. I've attached a revised patch that doesn't remove the counters (but doesn't increment them either: I'm not sure of all the places where the counter should be incremented). Neil Conway (user: bruce@momjian.us branch: trunk)
2002-09-14
19:59
[5a5944aa86] part of check-in [a4f5ecea8e] Cosmetic fixes from Neil Conway. (user: tgl@sss.pgh.pa.us branch: trunk)
2002-09-04
20:31
[3a83d6aa5c] part of check-in [22ceb1eaa6] pgindent run. (user: bruce@momjian.us branch: trunk)
2002-08-27
04:55
Added [4a2260b84d] part of check-in [c48aacd651] PREPARE/EXECUTE statements. Patch by Neil Conway, some kibitzing from Tom Lane. (user: tgl@sss.pgh.pa.us branch: trunk)