summaryrefslogtreecommitdiff
path: root/src/backend/nodes
Commit message (Collapse)AuthorAgeFilesLines
* Clean up a couple of ad-hoc computations of the maximum number of tuplesTom Lane2005-09-021-2/+2
| | | | | | | | | | | on a page, as suggested by ITAGAKI Takahiro. Also, change a few places that were using some other estimates of max-items-per-page to consistently use MaxOffsetNumber. This is conservatively large --- we could have used the new MaxHeapTuplesPerPage macro, or a similar one for index tuples --- but those places are simply declaring a fixed-size buffer and assuming it will work, rather than actively testing for overrun. It seems safer to size these buffers in a way that can't overflow even if the page is corrupt.
* Tweak nodeBitmapAnd to stop evaluating sub-plan scans if it finds it'sTom Lane2005-08-281-1/+10
| | | | | got an empty bitmap after any step; the remaining subplans can no longer affect the result. Per a suggestion from Ilia Kantor.
* Change the division of labor between grouping_planner and query_plannerTom Lane2005-08-271-1/+4
| | | | | | | | | | | | | | so that the latter estimates the number of groups that grouping will produce. This is needed because it is primarily query_planner that makes the decision between fast-start and fast-finish plans, and in the original coding it was unable to make more than a crude rule-of-thumb choice when the query involved grouping. This revision helps us make saner choices for queries like SELECT ... GROUP BY ... LIMIT, as in a recent example from Mark Kirkwood. Also move the responsibility for canonicalizing sort_pathkeys and group_pathkeys into query_planner; this information has to be available anyway to support the first change, and doing it this way lets us get rid of compare_noncanonical_pathkeys entirely.
* Add NOWAIT option to SELECT FOR UPDATE/SHARE.Tom Lane2005-08-014-10/+52
| | | | | Original patch by Hans-Juergen Schoenig, revisions by Karel Zak and Tom Lane.
* Add ALTER object SET SCHEMA capability for a limited but useful set ofTom Lane2005-08-012-6/+40
| | | | | | object kinds (tables, functions, types). Documentation is not here yet. Original code by Bernd Helmle, extensive rework by Bruce Momjian and Tom Lane.
* Add per-user and per-database connection limit options.Tom Lane2005-07-312-2/+28
| | | | | This patch also includes preliminary update of pg_dumpall for roles. Petr Jelinek, with review by Bruce Momjian and Tom Lane.
* Fix a bunch of bad interactions between partial indexes and the newTom Lane2005-07-281-5/+155
| | | | | | | | planning logic for bitmap indexscans. Partial indexes create corner cases in which a scan might be done with no explicit index qual conditions, and the code wasn't handling those cases nicely. Also be a little tenser about eliminating redundant clauses in the generated plan. Per report from Dmitry Karasik.
* Add a role property 'rolinherit' which, when false, denotes that the roleTom Lane2005-07-262-2/+4
| | | | | | | | | doesn't automatically inherit the privileges of roles it is a member of; for such a role, membership in another role can be exploited only by doing explicit SET ROLE. The default inherit setting is TRUE, so by default the behavior doesn't change, but creating a user with NOINHERIT gives closer adherence to our current reading of SQL99. Documentation still lacking, and I think the information schema needs another look.
* Fix logic error in tbm_intersect: the intersection of a normal page andTom Lane2005-07-241-6/+23
| | | | | a lossy page has to be lossy, because we don't know exactly which tuples on the page should remain part of the bitmap. Per Jie Zhang.
* Teach planner about some cases where a restriction clause can beTom Lane2005-07-023-6/+7
| | | | | | | | | | | | | | | propagated inside an outer join. In particular, given LEFT JOIN ON (A = B) WHERE A = constant, we cannot conclude that B = constant at the top level (B might be null instead), but we can nonetheless put a restriction B = constant into the quals for B's relation, since no inner-side rows not meeting that condition can contribute to the final result. Similarly, given FULL JOIN USING (J) WHERE J = constant, we can't directly conclude that either input J variable = constant, but it's OK to push such quals into each input rel. Per recent gripe from Kim Bisgaard. Along the way, remove 'valid_everywhere' flag from RestrictInfo, as on closer analysis it was not being used for anything, and was defined backwards anyway.
* Replace pg_shadow and pg_group by new role-capable catalogs pg_authidTom Lane2005-06-284-128/+84
| | | | | | | | and pg_auth_members. There are still many loose ends to finish in this patch (no documentation, no regression tests, no pg_dump support for instance). But I'm going to commit it now anyway so that Alvaro can make some progress on shared dependencies. The catalog changes should be pretty much done.
* Add Oracle-compatible GREATEST and LEAST functions. Pavel StehuleTom Lane2005-06-264-4/+65
|
* Make REINDEX DATABASE do what one would expect, namely reindex all indexesTom Lane2005-06-222-6/+6
| | | | | | | in the database. The old behavior (reindex system catalogs only) is now available as REINDEX SYSTEM. I did not add the complementary REINDEX USER case since there did not seem to be consensus for this, but it would be trivial to add later. Per recent discussions.
* Two-phase commit. Original patch by Heikki Linnakangas, with additionalTom Lane2005-06-172-2/+4
| | | | hacking by Alvaro Herrera and Tom Lane.
* Improve hash method for bitmapsets: some examination of actual outputsTom Lane2005-06-151-7/+21
| | | | | shows that adding a circular shift between words greatly improves the distribution of hash outputs.
* Simplify the planner's join clause management by storing join clausesTom Lane2005-06-093-44/+6
| | | | | | | | | | of a relation in a flat 'joininfo' list. The former arrangement grouped the join clauses according to the set of unjoined relids used in each; however, profiling on test cases involving lots of joins proves that that data structure is a net loss. It takes more time to group the join clauses together than is saved by avoiding duplicate tests later. It doesn't help any that there are usually not more than one or two clauses per group ...
* Marginal hack to avoid spending a lot of time in find_join_rel duringTom Lane2005-06-081-1/+26
| | | | | large planning problems: when the list of join rels gets too long, make an auxiliary hash table that hashes on the identifying Bitmapset.
* Nab some low-hanging fruit: replace the planner's base_rel_list andTom Lane2005-06-061-3/+2
| | | | | | | | other_rel_list with a single array indexed by rangetable index. This reduces find_base_rel from O(N) to O(1) without any real penalty. While find_base_rel isn't one of the major bottlenecks in any profile I've seen so far, it was starting to creep up on the radar screen for complex queries --- so might as well fix it.
* Remove planner's private fields from Query struct, and put them intoTom Lane2005-06-054-24/+88
| | | | | | | | a new PlannerInfo struct, which is passed around instead of the bare Query in all the planning code. This commit is essentially just a code-beautification exercise, but it does open the door to making larger changes to the planner data structures without having to muck with the widely-known Query struct.
* Modify hash_search() API to prevent future occurrences of the errorTom Lane2005-05-291-13/+1
| | | | | | | | | | | | | 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.
* Modify tidbitmap.c to avoid creating a hash table until there is moreTom Lane2005-05-171-149/+291
| | | | | | than one heap page represented in the bitmap. This is a bit ugly but it cuts overhead fairly effectively in simple join cases. Per example from Sergey Koposov.
* Fix duplicate call to WRITE_NODE_FIELD(whereClause) in _outSelectStmtTatsuo Ishii2005-05-091-2/+1
|
* Change CREATE TYPE to require datatype output and send functions to haveTom Lane2005-05-011-7/+4
| | | | | | | only one argument. (Per recent discussion, the option to accept multiple arguments is pretty useless for user-defined types, and would be a likely source of security holes if it was used.) Simplify call sites of output/send functions to not bother passing more than one argument.
* Implement sharable row-level locks, and use them for foreign key referencesTom Lane2005-04-284-7/+14
| | | | | | | | | | | | | | | to eliminate unnecessary deadlocks. This commit adds SELECT ... FOR SHARE paralleling SELECT ... FOR UPDATE. The implementation uses a new SLRU data structure (managed much like pg_subtrans) to represent multiple- transaction-ID sets. When more than one transaction is holding a shared lock on a particular row, we create a MultiXactId representing that set of transactions and store its ID in the row's XMAX. This scheme allows an effectively unlimited number of row locks, just as we did before, while not costing any extra overhead except when a shared lock actually has to be shared. Still TODO: use the regular lock manager to control the grant order when multiple backends are waiting for a row lock. Alvaro Herrera and Tom Lane.
* Remove support for OR'd indexscans internal to a single IndexScan planTom Lane2005-04-252-26/+24
| | | | | | | | node, as this behavior is now better done as a bitmap OR indexscan. This allows considerable simplification in nodeIndexscan.c itself as well as several planner modules concerned with indexscan plan generation. Also we can improve the sharing of code between regular and bitmap indexscans, since they are now working with nigh-identical Plan nodes.
* Rethink original decision to use AND/OR Expr nodes to represent bitmapTom Lane2005-04-211-1/+29
| | | | | | | logic operations during planning. Seems cleaner to create two new Path node types, instead --- this avoids duplication of cost-estimation code. Also, create an enable_bitmapscan GUC parameter to control use of bitmap plans.
* Install some slightly realistic cost estimation for bitmap index scans.Tom Lane2005-04-211-1/+3
|
* Create executor and planner-backend support for decoupled heap and indexTom Lane2005-04-194-18/+216
| | | | | | | | | scans, using in-memory tuple ID bitmaps as the intermediary. The planner frontend (path creation and cost estimation) is not there yet, so none of this code can be executed. I have tested it using some hacked planner code that is far too ugly to see the light of day, however. Committing now so that the bulk of the infrastructure changes go in before the tree drifts under me.
* Initial implementation of lossy-tuple-bitmap data structures.Tom Lane2005-04-172-2/+776
| | | | Not connected to anything useful yet ...
* Add a "USING" clause to DELETE, which is equivalent to the FROM clauseNeil Conway2005-04-072-2/+4
| | | | | | | | | | | | | | | in UPDATE. We also now issue a NOTICE if a query has _any_ implicit range table entries -- in the past, we would only warn about implicit RTEs in SELECTs with at least one explicit RTE. As a result of the warning change, 25 of the regression tests had to be updated. I also took the opportunity to remove some bogus whitespace differences between some of the float4 and float8 variants. I believe I have correctly updated all the platform-specific variants, but let me know if that's not the case. Original patch for DELETE ... USING from Euler Taveira de Oliveira, reworked by Neil Conway.
* Merge Resdom nodes into TargetEntry nodes to simplify code and save aTom Lane2005-04-066-125/+65
| | | | | | | | | few palloc's. I also chose to eliminate the restype and restypmod fields entirely, since they are redundant with information stored in the node's contained expression; re-examining the expression at need seems simpler and more reliable than trying to keep restype/restypmod up to date. initdb forced due to change in contents of stored rules.
* Fix grammar for IN/OUT/INOUT parameters. This commit doesn't actuallyTom Lane2005-03-292-2/+4
| | | | | | | | implement any new feature, it just pushes the 'not implemented' error message deeper into the backend. I also tweaked the grammar to accept Oracle-ish parameter syntax (parameter name first), as well as the SQL99 standard syntax (parameter mode first), since it was easy and people will doubtless try to use both anyway.
* Trivial comment tweak.Neil Conway2005-03-171-2/+2
|
* Revise TupleTableSlot code to avoid unnecessary construction and disassemblyTom Lane2005-03-161-4/+4
| | | | | | | | | | | | | | | | | | | | | of tuples when passing data up through multiple plan nodes. A slot can now hold either a normal "physical" HeapTuple, or a "virtual" tuple consisting of Datum/isnull arrays. Upper plan levels can usually just copy the Datum arrays, avoiding heap_formtuple() and possible subsequent nocachegetattr() calls to extract the data again. This work extends Atsushi Ogawa's earlier patch, which provided the key idea of adding Datum arrays to TupleTableSlots. (I believe however that something like this was foreseen way back in Berkeley days --- see the old comment on ExecProject.) A test case involving many levels of join of fairly wide tables (about 80 columns altogether) showed about 3x overall speedup, though simple queries will probably not be helped very much. I have also duplicated some code in heaptuple.c in order to provide versions of heap_formtuple and friends that use "bool" arrays to indicate null attributes, instead of the old convention of "char" arrays containing either 'n' or ' '. This provides a better match to the convention used by ExecEvalExpr. While I have not made a concerted effort to get rid of uses of the old routines, I think they should be deprecated and eventually removed.
* Allow ALTER FUNCTION to change a function's strictness, volatility, andNeil Conway2005-03-142-2/+28
| | | | | | | | | whether or not it is a security definer. Changing a function's strictness is required by SQL2003, and the other capabilities make sense. Also, allow an optional RESTRICT noise word to be specified, for SQL conformance. Some trivial regression tests added and the documentation has been updated.
* Make the behavior of HAVING without GROUP BY conform to the SQL spec.Tom Lane2005-03-102-11/+8
| | | | | | | | | Formerly, if such a clause contained no aggregate functions we mistakenly treated it as equivalent to WHERE. Per spec it must cause the query to be treated as a grouped query of a single group, the same as appearance of aggregate functions would do. Also, the HAVING filter must execute after aggregate function computation even if it itself contains no aggregate functions.
* Generalize TRUNCATE to support truncating multiple tables in oneTom Lane2005-01-272-4/+4
| | | | | | | | command. This is useful because we can allow truncation of tables referenced by foreign keys, so long as the referencing table is truncated in the same command. Alvaro Herrera
* Some more missed copyright notices. Many of these look like theyTom Lane2005-01-012-4/+4
| | | | | should have been caught by the src/tools/copyright script ... why weren't they?
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-3111-22/+22
| | | | | | | | 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 ...
* Instead of supposing (wrongly, in the general case) that the rowtypeTom Lane2004-12-114-4/+73
| | | | | | | | of an inheritance child table is binary-compatible with the rowtype of its parent, invent an expression node type that does the conversion correctly. Fixes the new bug exhibited by Kris Shannon as well as a lot of old bugs that would only show up when using multiple inheritance or after altering the parent table.
* Create 'default_tablespace' GUC variable that supplies a TABLESPACETom Lane2004-11-052-4/+2
| | | | | | | | | | clause implicitly whenever one is not given explicitly. Remove concept of a schema having an associated tablespace, and simplify the rules for selecting a default tablespace for a table or index. It's now just (a) explicit TABLESPACE clause; (b) default_tablespace if that's not an empty string; (c) database's default. This will allow pg_dump to use SET commands instead of tablespace clauses to determine object locations (but I didn't actually make it do so). All per recent discussions.
* Pgindent run for 8.0.Bruce Momjian2004-08-297-119/+123
|
* Update copyright to 2004.Bruce Momjian2004-08-2911-22/+22
|
* Code review for ALTER INDEX patch.Tom Lane2004-08-222-2/+4
|
* Label CVS tip as 8.0devel instead of 7.5devel. Adjust various commentsTom Lane2004-08-041-2/+2
| | | | and documentation to reference 8.0 instead of 7.5.
* Support USING INDEX TABLESPACE clause for PRIMARY KEY and UNIQUETom Lane2004-08-023-8/+12
| | | | constraints. Christopher Kings-Lynne.
* Allow DECLARE CURSOR to take parameters from the portal in which it isTom Lane2004-08-022-2/+124
| | | | | | | | | | 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.
* Remove TABLESPACE option of CREATE SEQUENCE; sequences will now alwaysTom Lane2004-07-122-4/+2
| | | | | | | live in database or schema's default tablespace, as per today's discussion. Also, remove some unused keywords from the grammar (PATH, PENDANT, VERSION), and fix ALSO, which was added as a keyword but not added to the keyword classification lists, thus making it worse-than-reserved.
* Support renaming of tablespaces, and changing the owners ofTom Lane2004-06-252-28/+36
| | | | | | | | aggregates, conversions, functions, operators, operator classes, schemas, types, and tablespaces. Fold the existing implementations of alter domain owner and alter database owner in with these. Christopher Kings-Lynne
* Tablespaces. Alternate database locations are dead, long live tablespaces.Tom Lane2004-06-183-5/+67
| | | | | | | | | There are various things left to do: contrib dbsize and oid2name modules need work, and so does the documentation. Also someone should think about COMMENT ON TABLESPACE and maybe RENAME TABLESPACE. Also initlocation is dead, it just doesn't know it yet. Gavin Sherry and Tom Lane.