summaryrefslogtreecommitdiff
path: root/src/backend/commands
AgeCommit message (Collapse)Author
2001-02-16Clean up two rather nasty bugs in operator selection code.Tom Lane
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
2001-02-14Change scoping of table and join refnames to conform to SQL92: a JOINTom Lane
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.
2001-02-13Added some comments to setval, setval_is_called and do_setvalPhilip Warner
2001-02-12Rearrange order of operations in heap_create_with_catalog so that ifTom Lane
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.
2001-01-29Clean up handling of tuple descriptors so that result-tuple descriptorsTom Lane
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.
2001-01-27Looks like I broke cases involving combinations of deferred update/deleteTom Lane
triggers ... oops ... but the regress tests should have covered this ...
2001-01-27Suppress coredump when EXPLAINing query that is rewritten to includeTom Lane
a NOTIFY.
2001-01-24Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian
2001-01-23Narrow scope of critical section, per discussion 1/19/01.Tom Lane
2001-01-23Fix all the places that called heap_update() and heap_delete() withoutTom Lane
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.
2001-01-23Rename int4 to int32 in a few places.Bruce Momjian
2001-01-22Clean up per-tuple memory leaks in trigger firing and plpgsqlTom Lane
expression evaluation.
2001-01-19Make critical sections (elog->crash) and interrupt holdoff sectionsTom Lane
into distinct concepts, per recent discussion on pghackers.
2001-01-19Suppress compiler warning in MULTIBYTE case.Tom Lane
2001-01-17Change lcons(x, NIL) to makeList(x) where appropriate.Bruce Momjian
2001-01-14Need to do BufferSync at end of DROP DATABASE as well as CREATE DATABASE.Tom Lane
Otherwise, newly connecting backends will still think the deleted DB is valid, and will generate unexpected error messages.
2001-01-14Restructure backend SIGINT/SIGTERM handling so that 'die' interruptsTom Lane
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.
2001-01-12Add more critical-section calls: all code sections that hold spinlocksTom Lane
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().
2001-01-12Preserve constraints and column defaults during CLUSTER.Tom Lane
Wish they were all this easy ...
2001-01-10Do The Right Thing (tm) if asked to cluster a temp table. PreviousTom Lane
code would cluster, but table would magically lose its tempness.
2001-01-08Keep relations open until they are no longer needed.Hiroshi Inoue
2001-01-07Clean up checking of relkind for ALTER TABLE and LOCK TABLE commands.Tom Lane
Disallow cases like adding constraints to sequences :-(, and eliminate now-unnecessary search of pg_rewrite to decide if a relation is a view.
2001-01-06Fix copy to make it more robust against unexpected characterTatsuo Ishii
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...
2001-01-05Disallow creation of a child table by a user who does not own the parentTom Lane
table, per pghackers discussion around 22-Dec-00.
2001-01-03New file format for COPY BINARY, in accordance with pghackers discussionsTom Lane
of early December 2000. COPY BINARY is now TOAST-safe.
2001-01-03MakeRetrieveViewRuleName was scribbling on memory that didn't belongTom Lane
to it. Bad dog.
2001-01-01CLUSTER forgot to create a TOAST table for the clustered relation.Tom Lane
2000-12-301. WAL needs in zero-ed content of newly initialized page.Vadim B. Mikheev
2. Log record for PageRepaireFragmentation now keeps array of !LP_USED offnums to redo cleanup properly.
2000-12-28New WAL version - CRC and data blocks backup.Vadim B. Mikheev
2000-12-27Fix portability problems recently exposed by regression tests on Alphas.Tom Lane
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.
2000-12-22Small cleanup of temp-table handling. Disallow creation of a non-tempTom Lane
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.)
2000-12-22Revise lock manager to support "session level" locks as well as "transactionTom Lane
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.
2000-12-21Fix longstanding bug with VIEW using BETWEEN: OffsetVarNodes would getTom Lane
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.
2000-12-18Ensure that 'errno' is saved and restored by all signal handlers thatTom Lane
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.
2000-12-18Clean up backend-exit-time cleanup behavior. Use on_shmem_exit callbacksTom Lane
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.
2000-12-15Remove a few remaining vestiges of elog(WARN).Tom Lane
2000-12-14Change StoreCatalogInheritance() to work from a list of parent relationTom Lane
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.
2000-12-08Add missing copyright and RCS identification header.Tom Lane
2000-12-08Remove error check that disallowed setval() on a sequence with cacheTom Lane
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...
2000-12-08Cache invalidation for vacuum of system tables.Hiroshi Inoue
2000-12-08REINDEX under WAL.Hiroshi Inoue
2000-12-05From Stephan Szabo:Tom Lane
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.
2000-12-03Ensure that all uses of <ctype.h> functions are applied to unsigned-charTom Lane
values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00.
2000-12-03Disable elog(ERROR|FATAL) in signal handlers inVadim B. Mikheev
critical sections of code.
2000-12-02Avoid memory leakage during regular COPY when outputting toasted values.Tom Lane
COPY BINARY is still broken for toasted data, however.
2000-12-02Avoid repeated detoasting (and possible memory leaks) when processingTom Lane
a toasted datum in VACUUM ANALYZE.
2000-11-30No more #ifdef XLOG.Vadim B. Mikheev
2000-11-30XLOG stuff for sequences.Vadim B. Mikheev
CommitDelay in guc.c
2000-11-28Significant cleanups in SysV IPC handling (shared mem and semaphores).Tom Lane
IPC key assignment will now work correctly even when multiple postmasters are using same logical port number (which is possible given -k switch). There is only one shared-mem segment per postmaster now, not 3. Rip out broken code for non-TAS case in bufmgr and xlog, substitute a complete S_LOCK emulation using semaphores in spin.c. TAS and non-TAS logic is now exactly the same. When deadlock is detected, "Deadlock detected" is now the elog(ERROR) message, rather than a NOTICE that comes out before an unhelpful ERROR.
2000-11-21Put external declarations into header files.Peter Eisentraut