summaryrefslogtreecommitdiff
path: root/src/backend/tcop/utility.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Two-phase commit. Original patch by Heikki Linnakangas, with additionalTom Lane2005-06-171-3/+35
| | | | hacking by Alvaro Herrera and Tom Lane.
* Implement sharable row-level locks, and use them for foreign key referencesTom Lane2005-04-281-3/+8
| | | | | | | | | | | | | | | 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.
* First phase of project to use fixed OIDs for all system catalogs andTom Lane2005-04-141-1/+2
| | | | | | | | | | | | | | | | indexes. Extend the macros in include/catalog/*.h to carry the info about hand-assigned OIDs, and adjust the genbki script and bootstrap code to make the relations actually get those OIDs. Remove the small number of RelOid_pg_foo macros that we had in favor of a complete set named like the catname.h and indexing.h macros. Next phase will get rid of internal use of names for looking up catalogs and indexes; but this completes the changes forcing an initdb, so it looks like a good place to commit. Along the way, I made the shared relations (pg_database etc) not be 'bootstrap' relations any more, so as to reduce the number of hardwired entries and simplify changing those relations in future. I'm not sure whether they ever really needed to be handled as bootstrap relations, but it seems to work fine to not do so now.
* Allow ALTER FUNCTION to change a function's strictness, volatility, andNeil Conway2005-03-141-1/+11
| | | | | | | | | 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.
* Generalize TRUNCATE to support truncating multiple tables in oneTom Lane2005-01-271-2/+2
| | | | | | | | 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
* Disallow LOAD to non-superusers. Per report from John Heasman.Tom Lane2005-01-241-1/+5
|
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-311-2/+2
| | | | | | | | Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
* Redesign query-snapshot timing so that volatile functions in READ COMMITTEDTom Lane2004-09-131-3/+90
| | | | | | | | | | | | | mode see a fresh snapshot for each command in the function, rather than using the latest interactive command's snapshot. Also, suppress fresh snapshots as well as CommandCounterIncrement inside STABLE and IMMUTABLE functions, instead using the snapshot taken for the most closely nested regular query. (This behavior is only sane for read-only functions, so the patch also enforces that such functions contain only SELECT commands.) As per my proposal of 6-Sep-2004; I note that I floated essentially the same proposal on 19-Jun-2002, but that discussion tailed off without any action. Since 8.0 seems like the right place to be taking possibly nontrivial backwards compatibility hits, let's get it done now.
* Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane2004-09-101-2/+2
| | | | | | | | | | | | | rather than when returning to the idle loop. This makes no particular difference for interactively-issued queries, but it makes a big difference for queries issued within functions: trigger execution now occurs before the calling function is allowed to proceed. This responds to numerous complaints about nonintuitive behavior of foreign key checking, such as http://archives.postgresql.org/pgsql-bugs/2004-09/msg00020.php, and appears to be required by the SQL99 spec. Also take the opportunity to simplify the data structures used for the pending-trigger list, rename them for more clarity, and squeeze out a bit of space.
* Pgindent run for 8.0.Bruce Momjian2004-08-291-28/+30
|
* Update copyright to 2004.Bruce Momjian2004-08-291-2/+2
|
* Add ALTER INDEX, particularly for moving tablespaces.Bruce Momjian2004-08-201-3/+18
| | | | Gavin Sherry
* Allow commas in BEGIN, START TRANSACTION, and SET TRANSACTION, as requiredTom Lane2004-08-121-16/+14
| | | | | | by the SQL standard. For backwards compatibility, however, continue to accept the syntax without. Minor editorialization in the reference pages for these commands, too.
* Allow optional SAVEPOINT keyword in RELEASE and ROLLBACK TO, for greaterTom Lane2004-08-121-3/+3
| | | | | | compliance with SQL2003 spec syntax. Oliver Jowett
* Allow DECLARE CURSOR to take parameters from the portal in which it isTom Lane2004-08-021-2/+4
| | | | | | | | | | 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.
* Some mop-up work for savepoints (nested transactions). Store a smallTom Lane2004-08-011-3/+2
| | | | | | | | | | | | number of active subtransaction XIDs in each backend's PGPROC entry, and use this to avoid expensive probes into pg_subtrans during TransactionIdIsInProgress. Extend EOXactCallback API to allow add-on modules to get control at subxact start/end. (This is deliberately not compatible with the former API, since any uses of that API probably need manual review anyway.) Add basic reference documentation for SAVEPOINT and related commands. Minor other cleanups to check off some of the open issues for subtransactions. Alvaro Herrera and Tom Lane.
* Replace nested-BEGIN syntax for subtransactions with spec-compliantTom Lane2004-07-271-2/+50
| | | | | | | SAVEPOINT/RELEASE/ROLLBACK-TO syntax. (Alvaro) Cause COMMIT of a failed transaction to report ROLLBACK instead of COMMIT in its command tag. (Tom) Fix a few loose ends in the nested-transactions stuff.
* Support renaming of tablespaces, and changing the owners ofTom Lane2004-06-251-24/+45
| | | | | | | | 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-181-1/+24
| | | | | | | | | 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.
* Separate out bgwriter code into a logically separate module, ratherTom Lane2004-05-291-3/+4
| | | | | | | | | than being random pieces of other files. Give bgwriter responsibility for all checkpoint activity (other than a post-recovery checkpoint); so this child process absorbs the functionality of the former transient checkpoint and shutdown subprocesses. While at it, create an actual include file for postmaster.c, which for some reason never had its own file before.
* This patch implement the TODO [ALTER DATABASE foo OWNER TO bar].Bruce Momjian2004-05-261-1/+13
| | | | | | | | | | It was necessary to touch in grammar and create a new node to make home to the new syntax. The command is also supported in E CPG. Doc updates are attached too. Only superusers can change the owner of the database. New owners don't need any aditional privileges. Euler Taveira de Oliveira
* Reimplement the linked list data structure used throughout the backend.Neil Conway2004-05-261-11/+11
| | | | | | | | | | | | | | | | 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.
* Refactor CheckDropPermissions() to move some initialization code forNeil Conway2004-05-071-12/+30
| | | | printing the proper error message out of the common path.
* ALTER TABLE rewrite. New cool stuff:Tom Lane2004-05-051-123/+8
| | | | | | | | | | | | | | | | | | | | * ALTER ... ADD COLUMN with defaults and NOT NULL constraints works per SQL spec. A default is implemented by rewriting the table with the new value stored in each row. * ALTER COLUMN TYPE. You can change a column's datatype to anything you want, so long as you can specify how to convert the old value. Rewrites the table. (Possible future improvement: optimize no-op conversions such as varchar(N) to varchar(N+1).) * Multiple ALTER actions in a single ALTER TABLE command. You can perform any number of column additions, type changes, and constraint additions with only one pass over the table contents. Basic documentation provided in ALTER TABLE ref page, but some more docs work is needed. Original patch from Rod Taylor, additional work from Tom Lane.
* This patch makes the EXECUTE command's completion tag return theBruce Momjian2004-04-221-2/+2
| | | | | | | | completion tag of the actual statement executed. This allows the correct update count to be returned for UPDATE/INSERT/DELETE statements. Kris Jurka
* Fix for BEGIN with ISOLATION/READONLY clauses.Bruce Momjian2004-04-191-9/+6
| | | | Fix for code originally added for 7.5.
* Upgrade ALTER TABLE DROP COLUMN so that it can drop an OID column, andTom Lane2004-03-231-3/+4
| | | | | | | | | remove separate implementation of ALTER TABLE SET WITHOUT OIDS in favor of doing a regular DROP. Also, cause CREATE TABLE to account completely correctly for the inheritance status of the OID column. This fixes problems with dropping OID columns that have dependencies, as noted by Christopher Kings-Lynne, as well as making sure that you can't drop an OID column that was inherited from a parent.
* Restructure smgr API as per recent proposal. smgr no longer depends onTom Lane2004-02-101-1/+2
| | | | | | | | | the relcache, and so the notion of 'blind write' is gone. This should improve efficiency in bgwriter and background checkpoint processes. Internal restructuring in md.c to remove the not-very-useful array of MdfdVec objects --- might as well just use pointers. Also remove the long-dead 'persistent main memory' storage manager (mm.c), since it seems quite unlikely to ever get resurrected.
* $Header: -> $PostgreSQL Changes ...PostgreSQL Daemon2003-11-291-1/+1
|
* Change some notices to warnings and vice versa according to criteriaPeter Eisentraut2003-10-021-2/+2
| | | | developed on -hackers.
* Repair some REINDEX problems per recent discussions. The relcache isTom Lane2003-09-241-3/+1
| | | | | | | | | | | | | now able to cope with assigning new relfilenode values to nailed-in-cache indexes, so they can be reindexed using the fully crash-safe method. This leaves only shared system indexes as special cases. Remove the 'index deactivation' code, since it provides no useful protection in the shared- index case. Require reindexing of shared indexes to be done in standalone mode, but remove other restrictions on REINDEX. -P (IgnoreSystemIndexes) now prevents using indexes for lookups, but does not disable index updates. It is therefore safe to allow from PGOPTIONS. Upshot: reindexing system catalogs can be done without a standalone backend for all cases except shared catalogs.
* Some "feature not supported" errors are better syntax errors, because thePeter Eisentraut2003-09-091-4/+4
| | | | | feature they complain about isn't a feature or cannot be implemented without definitional changes.
* Update copyrights to 2003.Bruce Momjian2003-08-041-2/+2
|
* pgindent run.Bruce Momjian2003-08-041-69/+76
|
* Adjust 'permission denied' messages to be more useful and consistent.Tom Lane2003-08-011-8/+10
|
* Error message editing in backend/libpq, backend/postmaster, backend/tcop.Tom Lane2003-07-221-55/+103
| | | | | Along the way, fix some logic problems in pgstat_initstats, notably the bogus assumption that malloc returns zeroed memory.
* First batch of object rename commands.Peter Eisentraut2003-06-271-95/+78
|
* Add display of eventual result RowDescription (if any) to the outputTom Lane2003-05-061-20/+3
| | | | | | 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.
* Restructure command destination handling so that we pass aroundTom Lane2003-05-061-4/+136
| | | | | | | | | | | | | | 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.
* Portal and memory management infrastructure for extended query protocol.Tom Lane2003-05-021-1/+384
| | | | | | | | | 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.
* Add ALTER TABLE <tablename> CLUSTER ON <indexname>Bruce Momjian2003-03-201-1/+4
| | | | Alvaro Herrera
* Todo items:Bruce Momjian2003-03-201-1/+6
| | | | | | | | | | | | | | | | | | | Add ALTER SEQUENCE to modify min/max/increment/cache/cycle values Also updated create sequence docs to mention NO MINVALUE, & NO MAXVALUE. New Files: doc/src/sgml/ref/alter_sequence.sgml src/test/regress/expected/sequence.out src/test/regress/sql/sequence.sql ALTER SEQUENCE is NOT transactional. It behaves similarly to setval(). It matches the proposed SQL200N spec, as well as Oracle in most ways -- Oracle lacks RESTART WITH for some strange reason. -- Rod Taylor <rbt@rbt.ca>
* Implement SQL92-compatible FIRST, LAST, ABSOLUTE n, RELATIVE n optionsTom Lane2003-03-111-10/+3
| | | | for FETCH and MOVE.
* Restructure parsetree representation of DECLARE CURSOR: now it's aTom Lane2003-03-101-3/+7
| | | | | | | | | | | | utility statement (DeclareCursorStmt) with a SELECT query dangling from it, rather than a SELECT query with a few unusual fields in it. Add code to determine whether a planned query can safely be run backwards. If DECLARE CURSOR specifies SCROLL, ensure that the plan can be run backwards by adding a Materialize plan node if it can't. Without SCROLL, you get an error if you try to fetch backwards from a cursor that can't handle it. (There is still some discussion about what the exact behavior should be, but this is necessary infrastructure in any case.) Along the way, make EXPLAIN DECLARE CURSOR work.
* Allow PQcmdTuples to return row counts for MOVE and FETCH.Bruce Momjian2003-02-191-2/+2
| | | | Neil Conway
* Code for WITHOUT OIDS.Bruce Momjian2003-02-131-2/+7
| | | | | | | | | On Wed, 2003-01-08 at 21:59, Christopher Kings-Lynne wrote: > I agree. I want to remove OIDs from heaps of our tables when we go to 7.3. > I'd rather not have to do it in the dump due to down time. Rod Taylor <rbt@rbt.ca>
* Get rid of last few vestiges of parsetree dependency on grammar tokenTom Lane2003-02-101-27/+19
| | | | | | codes, per discussion from last March. parse.h should now be included *only* by gram.y, scan.l, keywords.c, parser.c. This prevents surprising misbehavior after seemingly-trivial grammar adjustments.
* Get rid of last few unadorned 'permission denied' messages.Tom Lane2003-01-271-2/+2
|
* Read-only transactions, as defined in SQL.Peter Eisentraut2003-01-101-10/+115
|
* ALTER DOMAIN OWNER, from Rod Taylor.Tom Lane2003-01-061-5/+15
|