summaryrefslogtreecommitdiff
path: root/src/backend/commands
AgeCommit message (Collapse)Author
2001-10-12Break transformCreateStmt() into multiple routines and makeTom Lane
transformAlterStmt() use these routines, instead of having lots of duplicate (not to mention should-have-been-duplicate) code. Adding a column with a CHECK constraint actually works now, and the tests to reject unsupported DEFAULT and NOT NULL clauses actually fire now. ALTER TABLE ADD PRIMARY KEY works, modulo having to have created the column(s) NOT NULL already.
2001-10-08Make ALTER TABLE RENAME COLUMN update column names of indexes thatTom Lane
refer to the renamed column. Brent Verner, with a little help from tgl.
2001-10-05Further cleanup of dynahash.c API, in pursuit of portability andTom Lane
readability. Bizarre '(long *) TRUE' return convention is gone, in favor of just raising an error internally in dynahash.c when we detect hashtable corruption. HashTableWalk is gone, in favor of using hash_seq_search directly, since it had no hope of working with non-LONGALIGNable datatypes. Simplify some other code that was made undesirably grotty by promixity to HashTableWalk.
2001-10-04Consider interpreting a function call as a trivial (binary-compatible)Tom Lane
type coercion after failing to find an exact match in pg_proc, but before considering interpretations that involve a function call with one or more argument type coercions. This avoids surprises wherein what looks like a type coercion is interpreted as coercing to some third type and then to the destination type, as in Dave Blasby's bug report of 3-Oct-01. See subsequent discussion in pghackers.
2001-10-03DROP AGGREGATE and COMMENT ON AGGREGATE now accept the expected syntaxTom Lane
'aggname (aggtype)'. The old syntax 'aggname aggtype' is still accepted for backwards compatibility. Fix pg_dump, which was actually broken for most cases of user-defined aggregates. Clean up error messages associated with these commands.
2001-10-02Add CREATE OR REPLACE FUNCTION syntax to allow replacing a functionTom Lane
definition without changing the function's OID, thereby not breaking rules, views, triggers, etc that depend on it. From Gavin Sherry.
2001-09-29Implement new 'lightweight lock manager' that's intermediate betweenTom Lane
existing lock manager and spinlocks: it understands exclusive vs shared lock but has few other fancy features. Replace most uses of spinlocks with lightweight locks. All remaining uses of spinlocks have very short lock hold times (a few dozen instructions), so tweak spinlock backoff code to work efficiently given this assumption. All per my proposal on pghackers 26-Sep-01.
2001-09-21Give VACUUM its own GUC parameter for memory usage, rather thanTom Lane
piggybacking on SortMem. Add documentation for some recently-added GUC parameters that had so far escaped it.
2001-09-19Avoid unnecessary strcasecmp -- replace by strcmp. Fixes reported bugPeter Eisentraut
that made setting serializable isolation level impossible in Turkish locale.
2001-09-19Replace useless strcasecmp's by strcmp's.Peter Eisentraut
2001-09-18EXPLAIN ANALYZE feature to measure and show actual runtimes and tupleTom Lane
counts alongside the planner's estimates. By Martijn van Oosterhout, with some further work by Tom Lane.
2001-09-08Make the world somewhat safe for (not from) DELETE FROM pg_shadow;Peter Eisentraut
Assign the fixed user id 1 to the user created by initdb. A stand-alone backend will always set the user id to 1. (Consequently, the name of that user is no longer important.) In stand-alone mode, the user id 1 will have implicit superuser status, to allow repairs even if there are no users defined. Print a warning message when starting in stand-alone mode when no users are defined. Disallow dropping the current user and session user. Granting/revoking superuser status also grants/revokes usecatupd. (Previously, it would never grant it back. This could lead to "deadlocks".) CREATE USER and CREATE GROUP will start allocating user ids at 100 (unless explicitly specified), to prevent accidental creation of a superuser (plus some room for future extensions).
2001-09-08Clean up some confusion about where and how to set whereToSendOutput.Tom Lane
We will no longer try to send elog messages to the client before we have initialized backend libpq (oops); however, reporting bogus commandline switches via elog does work now (not irrelevant, because of PGOPTIONS). Fix problem with inappropriate sending of checkpoint-process messages to stderr.
2001-09-07Here is my much-promised patch to let people add UNIQUE constraints afterBruce Momjian
table creation time. Big deal you say - but this patch is the basis of the next thing which is adding PRIMARY KEYs after table creation time. (Which is currently impossible without twiddling catalogs) Rundown ------- * I have made the makeObjectName function of analyze.c non-static, and exported it in analyze.h * I have included analyze.h and defrem.h into command.c, to support makingObjectNames and creating indices * I removed the 'case CONSTR_PRIMARY' clause so that it properly fails and says you can't add primary keys, rather than just doing nothing and reporting nothing!!! * I have modified the docs. Algorithm --------- * If name specified is null, search for a new valid constraint name. I'm not sure if I should "lock" my generated name somehow tho - should I open the relation before doing this step? * Open relation in access exclusive mode * Check that the constraint does not already exist * Define the new index * Warn if they're doubling up on an existing index Christopher Kings-Lynne
2001-09-06Commit Karel's patch.Tatsuo Ishii
------------------------------------------------------------------- Subject: Re: [PATCHES] encoding names From: Karel Zak <zakkr@zf.jcu.cz> To: Peter Eisentraut <peter_e@gmx.net> Cc: pgsql-patches <pgsql-patches@postgresql.org> Date: Fri, 31 Aug 2001 17:24:38 +0200 On Thu, Aug 30, 2001 at 01:30:40AM +0200, Peter Eisentraut wrote: > > - convert encoding 'name' to 'id' > > I thought we decided not to add functions returning "new" names until we > know exactly what the new names should be, and pending schema Ok, the patch not to add functions. > better > > ...(): encoding name too long Fixed. I found new bug in command/variable.c in parse_client_encoding(), nobody probably never see this error: if (pg_set_client_encoding(encoding)) { elog(ERROR, "Conversion between %s and %s is not supported", value, GetDatabaseEncodingName()); } because pg_set_client_encoding() returns -1 for error and 0 as true. It's fixed too. IMHO it can be apply. Karel PS: * following files are renamed: src/utils/mb/Unicode/KOI8_to_utf8.map --> src/utils/mb/Unicode/koi8r_to_utf8.map src/utils/mb/Unicode/WIN_to_utf8.map --> src/utils/mb/Unicode/win1251_to_utf8.map src/utils/mb/Unicode/utf8_to_KOI8.map --> src/utils/mb/Unicode/utf8_to_koi8r.map src/utils/mb/Unicode/utf8_to_WIN.map --> src/utils/mb/Unicode/utf8_to_win1251.map * new file: src/utils/mb/encname.c * removed file: src/utils/mb/common.c -- Karel Zak <zakkr@zf.jcu.cz> http://home.zf.jcu.cz/~zakkr/ C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
2001-09-06Fix handling of pg_type.typdefault per bug report from Dave Blasby.Tom Lane
If there's anyone out there who's actually using datatype-defined default values, this will be an incompatible change in behavior ... but the old behavior was so broken that I doubt anyone was using it.
2001-09-04Fix comment, add Assert.Tom Lane
2001-08-26Transaction IDs wrap around, per my proposal of 13-Aug-01. MoreTom Lane
documentation to come, but the code is all here. initdb forced.
2001-08-23Ensure that all TransactionId comparisons are encapsulated in macrosTom Lane
(TransactionIdPrecedes, TransactionIdFollows, etc). First step on the way to transaction ID wrap solution ...
2001-08-21Restructure pg_opclass, pg_amop, and pg_amproc per previous discussions inTom Lane
pgsql-hackers. pg_opclass now has a row for each opclass supported by each index AM, not a row for each opclass name. This allows pg_opclass to show directly whether an AM supports an opclass, and furthermore makes it possible to store additional information about an opclass that might be AM-dependent. pg_opclass and pg_amop now store "lossy" and "haskeytype" information that we previously expected the user to remember to provide in CREATE INDEX commands. Lossiness is no longer an index-level property, but is associated with the use of a particular operator in a particular index opclass. Along the way, IndexSupportInitialize now uses the syscaches to retrieve pg_amop and pg_amproc entries. I find this reduces backend launch time by about ten percent, at the cost of a couple more special cases in catcache.c's IndexScanOK. Initial work by Oleg Bartunov and Teodor Sigaev, further hacking by Tom Lane. initdb forced.
2001-08-17Add 4-byte MD5 salt.Bruce Momjian
2001-08-16Sequences are now based on int8, not int4, arithmetic. SERIAL pseudo-typeTom Lane
has an alias SERIAL4 and a sister SERIAL8. SERIAL8 is just the same except the created column is type int8 not int4. initdb forced. Note this also breaks any chance of pg_upgrade from 7.1, unless we hack up pg_upgrade to drop and recreate sequences. (Which is not out of the question, but I don't wanna do it.)
2001-08-15Move md5.h contents to crypt.h.Bruce Momjian
2001-08-15Use MD5 for wire protocol encryption for >= 7.2 client/server.Bruce Momjian
Allow pg_shadow to be MD5 encrypted. Add ENCRYPTED/UNENCRYPTED option to CREATE/ALTER user. Add password_encryption postgresql.conf option. Update wire protocol version to 2.1.
2001-08-12Make ALTER TABLE RENAME on a view rename the view's on-select rule too.Tom Lane
Needed to keep pg_dump from getting confused.
2001-08-10Make OIDs optional, per discussions in pghackers. WITH OIDS is still theTom Lane
default, but OIDS are removed from many system catalogs that don't need them. Some interesting side effects: TOAST pointers are 20 bytes not 32 now; pg_description has a three-column key instead of one. Bugs fixed in passing: BINARY cursors work again; pg_class.relhaspkey has some usefulness; pg_dump dumps comments on indexes, rules, and triggers in a valid order. initdb forced.
2001-08-10Patch to LOCK multiple tables in one LOCK command.Bruce Momjian
Neil Padgett
2001-08-09Use format_type sibling in backend error messages, so the user seesPeter Eisentraut
consistent type naming.
2001-08-06Modify partial-index-predicate applicability tester to test whetherTom Lane
clauses are equal(), before trying to match them up using btree opclass inference rules. This allows it to recognize many simple cases involving non-btree operations, for example 'x IS NULL'. Clean up code a little.
2001-08-04Back out LOCK A,B,C patch at Tom's suggestion.Bruce Momjian
2001-08-04Add LOCK A,B,C functionality as LOCK A;LOCK B;LOCK C; as agreed.Bruce Momjian
Neil Padgett
2001-08-04Fix handling of SIGCHLD, per recent pghackers discussion: on someTom Lane
platforms system(2) gets confused unless the signal handler is set to SIG_DFL, not SIG_IGN. pgstats.c now uses pqsignal() as it should, not signal(). Also, arrange for the stats collector process to show a reasonable ID in 'ps', rather than looking like a postmaster.
2001-08-03For some reason, CREATE TYPE has only accepted alignment specificationsTom Lane
of 'int4' and 'double'. Add 'char' and 'int2' to allow user-defined types to access the full set of supported alignments.
2001-08-02Fix some poor decisions about sizing of trigger-related memory contexts.Tom Lane
2001-07-18New-style vacuum neglected to update pg_class statistics about indexesTom Lane
if there were no deletions to do.
2001-07-17Disallow non-cachable functions in functional indexes and in indexTom Lane
predicates. Per suggestion from Hiroshi.
2001-07-16Partial indexes work again, courtesy of Martijn van Oosterhout.Tom Lane
Note: I didn't force an initdb, figuring that one today was enough. However, there is a new function in pg_proc.h, and pg_dump won't be able to dump partial indexes until you add that function.
2001-07-15Restructure index AM interface for index building and index tuple deletion,Tom Lane
per previous discussion on pghackers. Most of the duplicate code in different AMs' ambuild routines has been moved out to a common routine in index.c; this means that all index types now do the right things about inserting recently-dead tuples, etc. (I also removed support for EXTEND INDEX in the ambuild routines, since that's about to go away anyway, and it cluttered the code a lot.) The retail indextuple deletion routines have been replaced by a "bulk delete" routine in which the indexscan is inside the access method. I haven't pushed this change as far as it should go yet, but it should allow considerable simplification of the internal bookkeeping for deletions. Also, add flag columns to pg_am to eliminate various hardcoded tests on AM OIDs, and remove unused pg_am columns. Fix rtree and gist index types to not attempt to store NULLs; before this, gist usually crashed, while rtree managed not to crash but computed wacko bounding boxes for NULL entries (which might have had something to do with the performance problems we've heard about occasionally). Add AtEOXact routines to hash, rtree, and gist, all of which have static state that needs to be reset after an error. We discovered this need long ago for btree, but missed the other guys. Oh, one more thing: concurrent VACUUM is now the default.
2001-07-13Initial implementation of concurrent VACUUM. Ifdef'd out for the moment,Tom Lane
because index locking issues are not handled correctly yet. Need to go work on the index AMs next.
2001-07-12indicies to indexes from Neil ConwayBruce Momjian
2001-07-12Remove grammar restrictions on order of optional clauses in CREATE GROUP.Tom Lane
From Vince Vielhaber.
2001-07-12Create a new HeapTupleSatisfiesVacuum() routine in tqual.c that embodies theTom Lane
validity checking rules for VACUUM. Make some other rearrangements of the VACUUM code to allow more code to be shared between full and lazy VACUUM. Minor code cleanups and added comments for TransactionId manipulations.
2001-07-11Disable COPY TO/FROM on views.Bruce Momjian
2001-07-11Remove direct calls of index_insert(), instead use ExecInsertIndexTuples().Tom Lane
This makes VACUUM work properly with partial indexes, and avoids memory leakage with functional indexes. Also, suppress complaint about fewer index tuples than heap tuples when the index is a partial index. From Martijn van Oosterhout.
2001-07-10Changes from Vince Vielhaber to allow the optional clauses of CREATETom Lane
USER and ALTER USER to appear in any order, not only the fixed order they used to be required to appear in. Also, some changes from Tom Lane to create a FULL option for VACUUM; it doesn't do anything yet, but I needed to change many of the same files to make that happen, so now seemed like a good time.
2001-07-05Don't assume that max offset number stays fixed on a page when we'reTom Lane
not holding a pin on the page. Use double instead of long to count rows in relation, so that code still works for > LONG_MAX rows in rel.
2001-07-02First non-stub implementation of shared free space map. It's not superTom Lane
useful as yet, since its primary source of information is (full) VACUUM, which makes a concerted effort to get rid of free space before telling the map about it ... next stop is concurrent VACUUM ...
2001-06-30Allow default transaction isolation level (a.k.a. set sessionPeter Eisentraut
characteristics) to be set through GUC.
2001-06-29Further work on connecting the free space map (which is still just aTom Lane
stub) into the rest of the system. Adopt a cleaner approach to preventing deadlock in concurrent heap_updates: allow RelationGetBufferForTuple to select any page of the rel, and put the onus on it to lock both buffers in a consistent order. Remove no-longer-needed isExtend hack from API of ReleaseAndReadBuffer.
2001-06-29Fix VACUUM so that it can use pages as move targets even if they do notTom Lane
have any newly-dead tuples on them. This is a longstanding deficiency that prevents VACUUM from compacting a file as much as one would expect. Change requires fixing repair_frag to not assume that fraged_pages is a subset of vacuum_pages. Also make some further cleanups of places that assumed page numbers fit in int and tuple counts fit in uint32.