summaryrefslogtreecommitdiff
path: root/src/backend/executor
AgeCommit message (Collapse)Author
2002-12-06Re-addd Rod's ALTER DOMAIN patch.Bruce Momjian
2002-12-06Back out ALTER DOMAIN patch until missing file appears.Bruce Momjian
2002-12-06ALTER DOMAIN .. SET / DROP NOT NULLBruce Momjian
ALTER DOMAIN .. SET / DROP DEFAULT ALTER DOMAIN .. ADD / DROP CONSTRAINT New files: - doc/src/sgml/ref/alter_domain.sgml Rod Taylor
2002-12-05Phase 1 of read-only-plans project: cause executor state nodes to pointTom Lane
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.
2002-12-05More cleanup of userid to be AclId rather than Oid.Bruce Momjian
2002-12-01Fix ExecMakeTableFunctionResult() to work with generic expressions asTom Lane
well as function calls. This is needed for cases where the planner has constant-folded or inlined the original function call. Possibly we should back-patch this change into 7.3 branch as well.
2002-11-30Code review for IS DISTINCT FROM patch. Fix incorrect constant-foldingTom Lane
logic, dissuade planner from thinking that 'x IS DISTINCT FROM 42' may be optimized into 'x = 42' (!!), cause dependency on = operator to be recorded correctly, minor other improvements.
2002-11-30Be more realistic about plans involving Materialize nodes: take theirTom Lane
cost into account while planning.
2002-11-30Upgrade planner and executor to allow multiple hash keys for a hash join,Tom Lane
instead of only one. This should speed up planning (only one hash path to consider for a given pair of relations) as well as allow more effective hashing, when there are multiple hashable joinclauses.
2002-11-29Tighten selection of equality and ordering operators for groupingTom Lane
operations: make sure we use operators that are compatible, as determined by a mergejoin link in pg_operator. Also, add code to planner to ensure we don't try to use hashed grouping when the grouping operators aren't marked hashable.
2002-11-29Suppress compiler warning from newer gcc.Tom Lane
2002-11-26Use Params, rather than run-time-modified Const nodes, to handleTom Lane
sublink results and COPY's domain constraint checking. A Const that isn't really constant is just a Bad Idea(tm). Remove hacks in parse_coerce and other places that were needed because of the former klugery.
2002-11-25Remove unused constisset and constiscast fields of Const nodes. CleanTom Lane
up code and documentation associated with Param nodes.
2002-11-23This patch implements FOR EACH STATEMENT triggers, per my email toBruce Momjian
-hackers a couple days ago. Notes/caveats: - added regression tests for the new functionality, all regression tests pass on my machine - added pg_dump support - updated PL/PgSQL to support per-statement triggers; didn't look at the other procedural languages. - there's (even) more code duplication in trigger.c than there was previously. Any suggestions on how to refactor the ExecXXXTriggers() functions to reuse more code would be welcome -- I took a brief look at it, but couldn't see an easy way to do it (there are several subtly-different versions of the code in question) - updated the documentation. I also took the liberty of removing a big chunk of duplicated syntax documentation in the Programmer's Guide on triggers, and moving that information to the CREATE TRIGGER reference page. - I also included some spelling fixes and similar small cleanups I noticed while making the changes. If you'd like me to split those into a separate patch, let me know. Neil Conway
2002-11-22Redesign internal logic of nodeLimit so that it does not need to fetchTom Lane
one more row from the subplan than the COUNT would appear to require. This costs a little more logic but a number of people have complained about the old implementation.
2002-11-19Add an at-least-marginally-plausible method of estimating the numberTom Lane
of groups produced by GROUP BY. This improves the accuracy of planning estimates for grouped subselects, and is needed to check whether a hashed aggregation plan risks memory overflow.
2002-11-15Add DOMAIN check constraints.Bruce Momjian
Rod Taylor
2002-11-13Make MOVE/FETCH 0 actually move/fetch 0. Add MOVE LAST to move to endBruce Momjian
of cursor.
2002-11-13Add new palloc0 call as merge of palloc and MemSet(0).Bruce Momjian
2002-11-11Code review for ON COMMIT patch. Make the actual on-commit action happenTom Lane
before commit, not after :-( --- the original coding is not only unsafe if an error occurs while it's processing, but it generates an invalid sequence of WAL entries. Resurrect 7.2 logic for deleting items when no longer needed. Use an enum instead of random macros. Editorialize on names used for routines and constants. Teach backend/nodes routines about new field in CreateTable struct. Add a regression test.
2002-11-11Back out use of palloc0 in place if palloc/MemSet. Seems constant lenBruce Momjian
to MemSet is a performance boost.
2002-11-10Merge palloc()/MemSet(0) calls into a single palloc0() call.Bruce Momjian
2002-11-09Add code to handle [ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP }]Bruce Momjian
for temp tables. Gavin Sherry
2002-11-06Phase 2 of hashed-aggregation project. nodeAgg.c now knows how to doTom Lane
hashed aggregation, but there's not yet planner support for it.
2002-11-06First phase of implementing hash-based grouping/aggregation. An AGG planTom Lane
node now does its own grouping of the input rows, and has no need for a preceding GROUP node in the plan pipeline. This allows elimination of the misnamed tuplePerGroup option for GROUP, and actually saves more code in nodeGroup.c than it costs in nodeAgg.c, as well as being presumably faster. Restructure the API of query_planner so that we do not commit to using a sorted or unsorted plan in query_planner; instead grouping_planner makes the decision. (Right now it isn't any smarter than query_planner was, but that will change as soon as it has the option to select a hash- based aggregation step.) Despite all the hackery, no initdb needed since only in-memory node types changed.
2002-11-02Clean up a few fprintf(stderr)'s that should be elog's.Tom Lane
2002-11-01Reduce a couple of debugging messages from LOG to DEBUG1 category.Tom Lane
2002-10-14Make SPI's execution of querystrings follow the rules agreed to forTom Lane
command status at the interactive level. SPI_processed, etc are set in the same way as the returned command status would have been set if the same querystring were issued interactively. Per gripe from Michael Paesold 25-Sep-02.
2002-10-14Arrange to copy relcache's trigdesc structure at the start of anyTom Lane
query that uses it. This ensures that triggers will be applied consistently throughout a query even if someone commits changes to the relation's pg_class.reltriggers field meanwhile. Per crash report from Laurette Cisneros. While at it, simplify memory management in relcache.c, which no longer needs the old hack to try to keep trigger info in the same place over a relcache entry rebuild. (Should try to fix rd_att and rewrite-rule access similarly, someday.) And make RelationBuildTriggers simpler and more robust by making it build the trigdesc in working memory and then CopyTriggerDesc() into cache memory.
2002-10-04Tweak a few of the most heavily used function call points to zero outTom Lane
just the significant fields of FunctionCallInfoData, rather than MemSet'ing the whole struct to zero. Unused positions in the arg[] array will thereby contain garbage rather than zeroes. This buys back some of the performance hit from increasing FUNC_MAX_ARGS. Also tweak tuplesort.c code for more speed by marking some routines 'inline'. All together these changes speed up simple sorts, like count(distinct int4column), by about 25% on a P4 running RH Linux 7.2.
2002-09-28Make the world at least somewhat safe for zero-column tables, andTom Lane
remove the special case in ALTER DROP COLUMN to prohibit dropping a table's last column.
2002-09-23Further thinking about heap_mark4update: in HeapTupleSelfUpdated case,Tom Lane
executor should not return the tuple as successfully marked, because in fact it's been deleted. Not clear that this case has ever been seen in practice (I think you'd have to write a SELECT FOR UPDATE that calls a function that deletes some row the SELECT will visit later...) but we should be consistent. Also add comments to several other places that got it right but didn't explain what they were doing.
2002-09-18Extend pg_cast castimplicit column to a three-way value; this allows usTom Lane
to be flexible about assignment casts without introducing ambiguity in operator/function resolution. Introduce a well-defined promotion hierarchy for numeric datatypes (int2->int4->int8->numeric->float4->float8). Change make_const to initially label numeric literals as int4, int8, or numeric (never float8 anymore). Explicitly mark Func and RelabelType nodes to indicate whether they came from a function call, explicit cast, or implicit cast; use this to do reverse-listing more accurately and without so many heuristics. Explicit casts to char, varchar, bit, varbit will truncate or pad without raising an error (the pre-7.2 behavior), while assigning to a column without any explicit cast will still raise an error for wrong-length data like 7.3. This more nearly follows the SQL spec than 7.2 behavior (we should be reporting a 'completion condition' in the explicit-cast cases, but we have no mechanism for that, so just do silent truncation). Fix some problems with enforcement of typmod for array elements; it didn't work at all in 'UPDATE ... SET array[n] = foo', for example. Provide a generalized array_length_coerce() function to replace the specialized per-array-type functions that used to be needed (and were missing for NUMERIC as well as all the datetime types). Add missing conversions int8<->float4, text<->numeric, oid<->int8. initdb forced.
2002-09-04pgindent run.Bruce Momjian
2002-09-02Remove sys/types.h in files that include postgres.h, and hence c.h,Bruce Momjian
because c.h has sys/types.h.
2002-09-02Code review for HeapTupleHeader changes. Add version number to page headersTom Lane
(overlaying low byte of page size) and add HEAP_HASOID bit to t_infomask, per earlier discussion. Simplify scheme for overlaying fields in tuple header (no need for cmax to live in more than one place). Don't try to clear infomask status bits in tqual.c --- not safe to do it there. Don't try to force output table of a SELECT INTO to have OIDs, either. Get rid of unnecessarily complex three-state scheme for TupleDesc.tdhasoids, which has already caused one recent failure. Improve documentation.
2002-08-31Code review for domain-constraints patch. Use a new ConstraintTest nodeTom Lane
type for runtime constraint checks, instead of misusing the parse-time Constraint node for the purpose. Fix some damage introduced into type coercion logic; in particular ensure that a coerced expression tree will read out the correct result type when inspected (patch had broken some RelabelType cases). Enforce domain NOT NULL constraints against columns that are omitted from an INSERT.
2002-08-31Wups, didn't mean to commit that just yet.Tom Lane
2002-08-31The UNDEFOID later causes an assertion failure in heap_formtuple whenTom Lane
you try to use the tupdesc to build a tuple. Joe Conway
2002-08-30Add expected tuple descriptor to ReturnSetInfo information for tableTom Lane
functions, per suggestion from John Gray and Joe Conway. Also, fix plpgsql RETURN NEXT to verify that returned values match the expected tupdesc.
2002-08-30PL/pgSQL functions can return sets. Neil Conway's patch, modified soTom Lane
that the functionality is available to anyone via ReturnSetInfo, rather than hard-wiring it to PL/pgSQL.
2002-08-29Adjust nodeFunctionscan.c to reset transient memory context between callsTom Lane
to the table function, thus preventing memory leakage accumulation across calls. This means that SRFs need to be careful to distinguish permanent and local storage; adjust code and documentation accordingly. Patch by Joe Conway, very minor tweaks by Tom Lane.
2002-08-29Code review for standalone composite types, query-specified compositeTom Lane
types, SRFs. Not happy with memory management yet, but I'll commit these other changes.
2002-08-28backend where a statically sized buffer is written to. Most of theseBruce Momjian
should be pretty safe in practice, but it's probably better to be safe than sorry. I was actually looking for cases where NAMEDATALEN is assumed to be 32, but only found one. That's fixed too, as well as a few bits of code cleanup. Neil Conway
2002-08-26Modify array operations to include array's element type OID in theTom Lane
array header, and to compute sizing and alignment of array elements the same way normal tuple access operations do --- viz, using the tupmacs.h macros att_addlength and att_align. This makes the world safe for arrays of cstrings or intervals, and should make it much easier to write array-type-polymorphic functions; as examples see the cleanups of array_out and contrib/array_iterator. By Joe Conway and Tom Lane.
2002-08-24The cstring datatype can now be copied, passed around, etc. The typlenTom Lane
value '-2' is used to indicate a variable-width type whose width is computed as strlen(datum)+1. Everything that looks at typlen is updated except for array support, which Joe Conway is working on; at the moment it wouldn't work to try to create an array of cstring.
2002-08-23Further cleanup around the edges of OPAQUE/pseudotype changes. CorrectTom Lane
the declarations of some index access method support functions. Support SQL functions returning VOID.
2002-08-15Tom Lane wrote:Bruce Momjian
> There's no longer a separate call to heap_storage_create in that routine > --- the right place to make the test is now in the storage_create > boolean parameter being passed to heap_create. A simple change, but > it passeth patch's understanding ... Thanks. Attached is a patch against cvs tip as of 8:30 PM PST or so. Turned out that even after fixing the failed hunks, there was a new spot in bufmgr.c which needed to be fixed (related to temp relations; RelationUpdateNumberOfBlocks). But thankfully the regression test code caught it :-) Joe Conway
2002-08-07Fix permission checking for temp-table namespace.Tom Lane
2002-08-06Restructure local-buffer handling per recent pghackers discussion.Tom Lane
The local buffer manager is no longer used for newly-created relations (unless they are TEMP); a new non-TEMP relation goes through the shared bufmgr and thus will participate normally in checkpoints. But TEMP relations use the local buffer manager throughout their lifespan. Also, operations in TEMP relations are not logged in WAL, thus improving performance. Since it's no longer necessary to fsync relations as they move out of the local buffers into shared buffers, quite a lot of smgr.c/md.c/fd.c code is no longer needed and has been removed: there's no concept of a dirty relation anymore in md.c/fd.c, and we never fsync anything but WAL. Still TODO: improve local buffer management algorithms so that it would be reasonable to increase NLocBuffer.