summaryrefslogtreecommitdiff
path: root/src/backend/commands
Commit message (Collapse)AuthorAgeFilesLines
* Reduce amount of memory used per tuple for after-event triggers. ThisTom Lane2001-03-141-23/+24
| | | | is still a memory leak, but a little less bad than it was.
* COPY should handle after-insert triggers the same as execMain.c does.Tom Lane2001-03-141-5/+4
| | | | | | I'm not sure that it's really necessary to save insert events when there are only after update or delete triggers, but certainly it's wrong for COPY to behave differently from an INSERT query.
* ifdef out reindex stuff in VACUUM for safety.Hiroshi Inoue2001-03-141-1/+9
|
* Avoid O(N^2) behavior in deferredTriggerAddEvent() for large numbers ofTom Lane2001-03-121-8/+23
| | | | | | tuples inserted/deleted/updated in a single transaction. On my machine, this reduced the time to delete 80000 tuples in a foreign-key-referencing table from ~15min to ~8sec.
* Repair a number of places that didn't bother to check whether PageAddItemTom Lane2001-03-071-2/+3
| | | | | | | | | | succeeds or not. Revise rtree page split algorithm to take care about making a feasible split --- ie, will the incoming tuple actually fit? Failure to make a feasible split, combined with failure to notice the failure, account for Jim Stone's recent bug report. I suspect that hash and gist indices may have the same type of bug, but at least now we'll get error messages rather than silent failures if so. Also clean up rtree code to use Datum rather than char* where appropriate.
* Tweak portal (cursor) code so that it will not call the executor againTom Lane2001-02-271-19/+41
| | | | | | | | | | | when user does another FETCH after reaching end of data, or another FETCH backwards after reaching start. This is needed because some plan nodes are not very robust about being called again after they've already returned NULL; for example, MergeJoin will crash in some states but not others. While the ideal approach would be for them all to handle this correctly, it seems foolish to assume that no such bugs would creep in again once cleaned up. Therefore, the most robust answer is to prevent the situation from arising at all.
* Reindex of shared system indexes must be overwrite mode.Hiroshi Inoue2001-02-231-2/+5
|
* Clean up two rather nasty bugs in operator selection code.Tom Lane2001-02-161-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. If there is exactly one pg_operator entry of the right name and oprkind, oper() and related routines would return that entry whether its input type had anything to do with the request or not. This is just premature optimization: we shouldn't return the single candidate until after we verify that it really is a valid candidate, ie, is at least coercion-compatible with the given types. 2. oper() and related routines only promise a coercion-compatible result. Unfortunately, there were quite a few callers that assumed the returned operator is binary-compatible with the given datatype; they would proceed to call it without making any datatype coercions. These callers include sorting, grouping, aggregation, and VACUUM ANALYZE. In general I think it is appropriate for these callers to require an exact or binary-compatible match, so I've added a new routine compatible_oper() that only succeeds if it can find an operator that doesn't require any run-time conversions. Callers now call oper() or compatible_oper() depending on whether they are prepared to deal with type conversion or not. The upshot of these bugs is revealed by the following silliness in PL/Tcl's selftest: it creates an operator @< on int4, and then tries to use it to sort a char(N) column. The system would let it do that :-( (and evidently has done so since 6.3 :-( :-(). The result in this case was just a silly sort order, but the reverse combination would've provoked coredump from trying to dereference integers. With this fix you get more reasonable behavior: pltcl_test=# select * from T_pkey1 order by key1, key2 using @<; ERROR: Unable to identify an operator '@<' for types 'bpchar' and 'bpchar' You will have to retype this query using an explicit cast
* Change scoping of table and join refnames to conform to SQL92: a JOINTom Lane2001-02-141-3/+2
| | | | | | | | | clause with an alias is a <subquery> and therefore hides table references appearing within it, according to the spec. This is the same as the preliminary patch I posted to pgsql-patches yesterday, plus some really grotty code in ruleutils.c to reverse-list a query tree with the correct alias name depending on context. I'd rather not have done that, but unless we want to force another initdb for 7.1, there's no other way for now.
* Added some comments to setval, setval_is_called and do_setvalPhilip Warner2001-02-131-1/+22
|
* Rearrange order of operations in heap_create_with_catalog so that ifTom Lane2001-02-121-2/+4
| | | | | | | | | two transactions create the same table name concurrently, the one that fails will complain about unique index pg_class_relname_index, rather than about pg_type_typname_index which'll confuse most people. Free side benefit: pg_class.reltype is correctly linked to the pg_type entry now. It's been zero in all but the preloaded pg_class entries since who knows when.
* Clean up handling of tuple descriptors so that result-tuple descriptorsTom Lane2001-01-292-15/+15
| | | | | | | | allocated by plan nodes are not leaked at end of query. This doesn't really matter for normal queries, but it sure does for queries invoked repetitively inside SQL functions. Clean up some other grotty code associated with tupdescs, and fix a few other memory leaks exposed by tests with simple SQL functions.
* Looks like I broke cases involving combinations of deferred update/deleteTom Lane2001-01-271-31/+50
| | | | triggers ... oops ... but the regress tests should have covered this ...
* Suppress coredump when EXPLAINing query that is rewritten to includeTom Lane2001-01-271-2/+12
| | | | a NOTIFY.
* Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian2001-01-2421-42/+42
|
* Narrow scope of critical section, per discussion 1/19/01.Tom Lane2001-01-231-2/+2
|
* Fix all the places that called heap_update() and heap_delete() withoutTom Lane2001-01-2311-55/+55
| | | | | | | | | | | bothering to check the return value --- which meant that in case the update or delete failed because of a concurrent update, you'd not find out about it, except by observing later that the transaction produced the wrong outcome. There are now subroutines simple_heap_update and simple_heap_delete that should be used anyplace that you're not prepared to do the full nine yards of coping with concurrent updates. In practice, that seems to mean absolutely everywhere but the executor, because *noplace* else was checking.
* Rename int4 to int32 in a few places.Bruce Momjian2001-01-232-3/+3
|
* Clean up per-tuple memory leaks in trigger firing and plpgsqlTom Lane2001-01-222-33/+63
| | | | expression evaluation.
* Make critical sections (elog->crash) and interrupt holdoff sectionsTom Lane2001-01-191-8/+7
| | | | into distinct concepts, per recent discussion on pghackers.
* Suppress compiler warning in MULTIBYTE case.Tom Lane2001-01-191-2/+2
|
* Change lcons(x, NIL) to makeList(x) where appropriate.Bruce Momjian2001-01-171-3/+4
|
* Need to do BufferSync at end of DROP DATABASE as well as CREATE DATABASE.Tom Lane2001-01-141-3/+13
| | | | | Otherwise, newly connecting backends will still think the deleted DB is valid, and will generate unexpected error messages.
* Restructure backend SIGINT/SIGTERM handling so that 'die' interruptsTom Lane2001-01-143-14/+7
| | | | | | | are treated more like 'cancel' interrupts: the signal handler sets a flag that is examined at well-defined spots, rather than trying to cope with an interrupt that might happen anywhere. See pghackers discussion of 1/12/01.
* Add more critical-section calls: all code sections that hold spinlocksTom Lane2001-01-122-14/+14
| | | | | | | | | | | are now critical sections, so as to ensure die() won't interrupt us while we are munging shared-memory data structures. Avoid insecure intermediate states in some code that proc_exit will call, like palloc/pfree. Rename START/END_CRIT_CODE to START/END_CRIT_SECTION, since that seems to be what people tend to call them anyway, and make them be called with () like a function call, in hopes of not confusing pg_indent. I doubt that this is sufficient to make SIGTERM safe anywhere; there's just too much code that could get invoked during proc_exit().
* Preserve constraints and column defaults during CLUSTER.Tom Lane2001-01-121-2/+2
| | | | Wish they were all this easy ...
* Do The Right Thing (tm) if asked to cluster a temp table. PreviousTom Lane2001-01-101-8/+17
| | | | code would cluster, but table would magically lose its tempness.
* Keep relations open until they are no longer needed.Hiroshi Inoue2001-01-081-2/+3
|
* Clean up checking of relkind for ALTER TABLE and LOCK TABLE commands.Tom Lane2001-01-071-91/+39
| | | | | Disallow cases like adding constraints to sequences :-(, and eliminate now-unnecessary search of pg_rewrite to decide if a relation is a view.
* Fix copy to make it more robust against unexpected characterTatsuo Ishii2001-01-061-25/+39
| | | | | | | | sequences. This is done by disabling multi-byte awareness when it's not necessary. This is kind of a workaround, not a perfect solution. However, there is no ideal way to parse broken multi-byte character sequences. So I guess this is the best way what we could do right now...
* Disallow creation of a child table by a user who does not own the parentTom Lane2001-01-051-1/+8
| | | | table, per pghackers discussion around 22-Dec-00.
* New file format for COPY BINARY, in accordance with pghackers discussionsTom Lane2001-01-031-179/+249
| | | | of early December 2000. COPY BINARY is now TOAST-safe.
* MakeRetrieveViewRuleName was scribbling on memory that didn't belongTom Lane2001-01-031-10/+11
| | | | to it. Bad dog.
* CLUSTER forgot to create a TOAST table for the clustered relation.Tom Lane2001-01-011-6/+17
|
* 1. WAL needs in zero-ed content of newly initialized page.Vadim B. Mikheev2000-12-301-10/+22
| | | | | 2. Log record for PageRepaireFragmentation now keeps array of !LP_USED offnums to redo cleanup properly.
* New WAL version - CRC and data blocks backup.Vadim B. Mikheev2000-12-282-71/+107
|
* Fix portability problems recently exposed by regression tests on Alphas.Tom Lane2000-12-271-55/+7
| | | | | | | | | | 1. Distinguish cases where a Datum representing a tuple datatype is an OID from cases where it is a pointer to TupleTableSlot, and make sure we use the right typlen in each case. 2. Make fetchatt() and related code support 8-byte by-value datatypes on machines where Datum is 8 bytes. Centralize knowledge of the available by-value datatype sizes in two macros in tupmacs.h, so that this will be easier if we ever have to do it again.
* Small cleanup of temp-table handling. Disallow creation of a non-tempTom Lane2000-12-223-12/+16
| | | | | | | table that inherits from a temp table. Make sure the right things happen if one creates a temp table, creates another temp that inherits from it, then renames the first one. (Previously, system would end up trying to delete the temp tables in the wrong order.)
* Revise lock manager to support "session level" locks as well as "transactionTom Lane2000-12-221-41/+49
| | | | | | | | | | | | | | | | level" locks. A session lock is not released at transaction commit (but it is released on transaction abort, to ensure recovery after an elog(ERROR)). In VACUUM, use a session lock to protect the master table while vacuuming a TOAST table, so that the TOAST table can be done in an independent transaction. I also took this opportunity to do some cleanup and renaming in the lock code. The previously noted bug in ProcLockWakeup, that it couldn't wake up any waiters beyond the first non-wakeable waiter, is now fixed. Also found a previously unknown bug of the same kind (failure to scan all members of a lock queue in some cases) in DeadLockCheck. This might have led to failure to detect a deadlock condition, resulting in indefinite waits, but it's difficult to characterize the conditions required to trigger a failure.
* Fix longstanding bug with VIEW using BETWEEN: OffsetVarNodes would getTom Lane2000-12-211-28/+29
| | | | | | applied to the duplicated subtree twice. Probably someday we should fix the parser not to generate multiple links to the same subtree, but for now a quick copyObject() is the path of least resistance.
* Ensure that 'errno' is saved and restored by all signal handlers thatTom Lane2000-12-181-1/+4
| | | | | | might change it. Experimentation shows that the signal handler call mechanism does not save/restore errno for you, at least not on Linux or HPUX, so this is definitely a real risk.
* Clean up backend-exit-time cleanup behavior. Use on_shmem_exit callbacksTom Lane2000-12-181-4/+2
| | | | | | to ensure that we have released buffer refcounts and so forth, rather than putting ad-hoc operations before (some of the calls to) proc_exit. Add commentary to discourage future hackers from repeating that mistake.
* Remove a few remaining vestiges of elog(WARN).Tom Lane2000-12-152-5/+5
|
* Change StoreCatalogInheritance() to work from a list of parent relationTom Lane2000-12-141-64/+55
| | | | | | OIDs rather than names. Aside from being simpler and faster, this way doesn't blow up in the face of 'create temp table foo () inherits (foo)'. Which is a rather odd thing to do, but it seems some people want to.
* Add missing copyright and RCS identification header.Tom Lane2000-12-081-2/+8
|
* Remove error check that disallowed setval() on a sequence with cacheTom Lane2000-12-081-14/+6
| | | | | | | | | value greater than one. The behavior this sought to disallow doesn't seem any less confusing than the other behaviors of cached sequences. Improve wording of some error messages, too. Update documentation accordingly. Also add an explanation that aborted transactions do not roll back their nextval() calls; this seems to be a FAQ, so it ought to be mentioned here...
* Cache invalidation for vacuum of system tables.Hiroshi Inoue2000-12-081-1/+6
|
* REINDEX under WAL.Hiroshi Inoue2000-12-081-2/+6
|
* From Stephan Szabo:Tom Lane2000-12-051-15/+22
| | | | | | | | | | I believe this should fix the issue that Philip Warner noticed about the check for unique constraints meeting the referenced keys of a foreign key constraint allowing the specification of a subset of a foreign key instead of rejecting it. I also added tests for a base case of this to the foreign key and alter table tests and patches for expected output.
* Ensure that all uses of <ctype.h> functions are applied to unsigned-charTom Lane2000-12-034-13/+13
| | | | | values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00.