summaryrefslogtreecommitdiff
path: root/src/backend
Commit message (Collapse)AuthorAgeFilesLines
* Update obsolete comment.Neil Conway2005-03-131-10/+4
|
* Document aliases for our supported encodings.Bruce Momjian2005-03-131-4/+1
| | | | Add a few encodings that were not documented.
* When cloning template0 (or other fully-frozen databases), set the newTom Lane2005-03-121-7/+25
| | | | | | | | | | | database's datallowconn and datfrozenxid to the current transaction ID instead of copying the source database's values. This is OK because we assume the source DB contains no normal transaction IDs whatsoever. This keeps VACUUM from immediately starting to complain about unvacuumed databases in the situation where we are more than 2 billion transactions out from the XID stamp of template0. Per discussion with Milen Radev (although his complaint turned out to be due to something else, but the problem is real anyway).
* Fix ALTER DATABASE RENAME to allow the operation if user is a superuserTom Lane2005-03-121-15/+12
| | | | | who for some reason isn't marked usecreatedb. Per report from Alexander Pravking. Also fix sloppy coding in have_createdb_privilege().
* Adjust the API for aggregate function calls so that a C-coded functionTom Lane2005-03-122-12/+58
| | | | | | | | | | | | | can tell whether it is being used as an aggregate or not. This allows such a function to avoid re-pallocing a pass-by-reference transition value; normally it would be unsafe for a function to scribble on an input, but in the aggregate case it's safe to reuse the old transition value. Make int8inc() do this. This gets a useful improvement in the speed of COUNT(*), at least on narrow tables (it seems to be swamped by I/O when the table rows are wide). Per a discussion in early December with Neil Conway. I also fixed int_aggregate.c to check this, thereby turning it into something approaching a supportable technique instead of being a crude hack.
* Handle carriage returns and line feeds in COPY CSV mode.Bruce Momjian2005-03-121-76/+120
| | | | Andrew Dunstan
* Add warning about the need to increase "max_fsm_relations" andBruce Momjian2005-03-121-3/+17
| | | | | | | "max_fsm_relations" for vacuums. Also improve VACUUM VERBOSE final message text. Ron Mayer
* Fix problem with infinite recursion between write_syslogger_file andTom Lane2005-03-122-11/+15
| | | | | | | | elog if the former has trouble writing its file. Code review for Magnus' patch to redirect stderr to syslog on Windows (Bruce's version seems right, but did some minor prettification). Backpatch both changes to 8.0 branch.
* Add fprintf() custom version to libpgport.Bruce Momjian2005-03-113-3/+6
| | | | | | | Document use of macros for pg_printf functions. Bump major versions of all interfaces to handle movement of get_progname from libpq to libpgport in 8.0, and probably other libpgport changes in 8.1.
* Slight refactoring and optimization of some code in WaitOnLock().Neil Conway2005-03-111-4/+6
|
* Make the behavior of HAVING without GROUP BY conform to the SQL spec.Tom Lane2005-03-1011-224/+231
| | | | | | | | | 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.
* Refactor fork()-related code. We need to do various housekeeping tasksNeil Conway2005-03-106-151/+100
| | | | | | | | | | before we can invoke fork() -- flush stdio buffers, save and restore the profiling timer on Linux with LINUX_PROFILE, and handle BeOS stuff. This patch moves that code into a single function, fork_process(), instead of duplicating it at the various callsites of fork(). This patch doesn't address the EXEC_BACKEND case; there is room for further cleanup there.
* Unbreak out-of-tree builds, by fixing a typo.Neil Conway2005-03-071-2/+2
|
* Adjust creation/destruction of TupleDesc data structure to reduce theTom Lane2005-03-073-95/+69
| | | | | | number of palloc calls. This has a salutory impact on plpgsql operations with record variables (which create and destroy tupdescs constantly) and probably helps a bit in some other cases too.
* Rename canonical encodings, per Peter:Bruce Momjian2005-03-0748-356/+291
| | | | | | | | | UNICODE => UTF8 ALT => WIN866 WIN => WIN1251 TCVN => WIN1258 The old codes continue to work.
* Here's a tiny fix for a harmless typo in catalog.c:Neil Conway2005-03-071-3/+3
| | | | | | | | Too much space is allocated for tablespace file path, I guess the directory name used to be "pg_tablespaces" instead of "pg_tblspc" at some point. Heikki Linnakangas
* Revise hash join code so that we can increase the number of batchesTom Lane2005-03-064-375/+555
| | | | | | | on-the-fly, and thereby avoid blowing out memory when the planner has underestimated the hash table size. Hash join will now obey the work_mem limit with some faithfulness. Per my recent proposal (hash aggregate part isn't done yet though).
* Replace the BufMgrLock with separate locks on the lookup hashtable andTom Lane2005-03-0413-1826/+1217
| | | | | | | | the freelist, plus per-buffer spinlocks that protect access to individual shared buffer headers. This requires abandoning a global freelist (since the freelist is a global contention point), which shoots down ARC and 2Q as well as plain LRU management. Adopt a clock sweep algorithm instead. Preliminary results show substantial improvement in multi-backend situations.
* Another go at making pred_test() handle all reasonable combinationsTom Lane2005-03-021-117/+158
| | | | | | | | | | of AND and OR clauses. The key point here is that an OR on the predicate side has to be treated gingerly: we may be able to prove that the OR is implied even when no one of its components is implied. For example (x OR y) implies (x OR y OR z) even though no one of x, y, or z can be individually proven. This code handles both the example shown recently by Sergey Koshcheyev and the one shown last October by Dawid Kuroczko.
* Release proclock immediately in RemoveFromWaitQueue() if it representsTom Lane2005-03-011-14/+34
| | | | | | no held locks. This maintains the invariant that proclocks are present only for procs that are holding or awaiting a lock; when this is not true, LockRelease will fail. Per report from Stephen Clouse.
* Allow Trace_lock_oidmin to be set to zero; this is a reasonableTom Lane2005-03-011-2/+2
| | | | representation of not wanting tracing to be limited by object OID.
* Adjust OR indexscan logic to not generate redundant condition-free ORTom Lane2005-03-011-4/+8
| | | | | | indexscans involving partial indexes. These would always be dominated by a simple indexscan on such an index, so there's no point in considering them. Fixes overoptimism in a patch I applied last October.
* Revert the logic for expanding AND/OR conditions in pred_test() to whatTom Lane2005-03-011-54/+69
| | | | | | it was in 7.4, and add some comments explaining why it has to be this way. I broke it for OR'd index predicates in a fit of code cleanup last summer. Per example from Sergey Koshcheyev.
* Implement max() and min() aggregates for array types. Patch from KojuNeil Conway2005-02-281-1/+31
| | | | | Iijima, reviewed by Neil Conway. Catalog version number bumped, regression tests updated.
* Add explicit casts between int4 and boolean. Patch from Sean Chittenden,Neil Conway2005-02-271-1/+20
| | | | editorializing by Neil Conway. Catalog version bumped.
* Cause Win32 to output to the event log rather than stderr by default.Bruce Momjian2005-02-271-1/+12
| | | | Magnus Hagander
* Finish up the flat-files project: get rid of GetRawDatabaseInfo() hackTom Lane2005-02-267-294/+163
| | | | | | | | | | | in favor of looking at the flat file copy of pg_database during backend startup. This should finally eliminate the various corner cases in which backend startup fails unexpectedly because it isn't able to distinguish live and dead tuples in pg_database. Simplify locking on pg_database to be similar to the rules used with pg_shadow and pg_group, and eliminate FlushRelationBuffers operations that were used only to reduce the odds of failure of GetRawDatabaseInfo. initdb forced due to addition of a trigger to pg_database.
* Minor code cleanup: remove a variable that was assigned to but neverNeil Conway2005-02-231-3/+2
| | | | | | | subsequently referenced. Found by: Coverity Fixed by: Sean Chittenden
* This patch optimizes the md5_text() function (which is used toNeil Conway2005-02-232-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | implement the md5() SQL-level function). The old code did the following: 1. de-toast the datum 2. convert it to a cstring via textout() 3. get the length of the cstring via strlen() Since we are treating the datum context as a blob of binary data, the latter two steps are unnecessary. Once the data has been detoasted, we can just use it as-is, and derive its length from the varlena metadata. This patch improves some run-of-the-mill md5() computations by just under 10% in my limited tests, and passes the regression tests. I also noticed that md5_text() wasn't checking the return value of md5_hash(); encountering OOM at precisely the right moment could result in returning a random md5 hash. This patch corrects that. A better fix would be to make md5_hash() only return on success (and/or allocate via palloc()), but since it's used in the frontend as well I don't see an easy way to do that.
* Use _() macro consistently rather than gettext(). Add translationBruce Momjian2005-02-229-130/+130
| | | | macros around strings that were missing them.
* Use SnapshotNow instead of SnapshotSelf for reading the catalogsTom Lane2005-02-201-13/+13
| | | | | | | | during flat-file writing. The only difference is that SnapshotSelf would consider tuples of the 'current command' within the current transaction as valid, where SnapshotNow wouldn't. We can eliminate the need for this with one extra CommandCounterIncrement call before we start reading the catalogs.
* Remove some no-longer-needed kluges for bootstrapping, in particularTom Lane2005-02-205-60/+16
| | | | | | | | the AMI_OVERRIDE flag. The fact that TransactionLogFetch treats BootstrapTransactionId as always committed is sufficient to make bootstrap work, and getting rid of extra tests in heavily used code paths seems like a win. The files produced by initdb are demonstrably the same after this change.
* Rename macro to MAKE_EXPIRED_TUPLES_VISIBLE.Bruce Momjian2005-02-201-2/+2
|
* Fix MAKE_ALL_TUPLES_VISIBLE define.Bruce Momjian2005-02-201-2/+2
|
* Move define MAKE_ALL_TUPLES_VISIBLE to a more logical place.Bruce Momjian2005-02-201-6/+6
|
* I have added a define, MAKE_ALL_TUPLES_VISIBLE, to help people recoverBruce Momjian2005-02-201-1/+6
| | | | deleted tuples. Of course it is only to be used for disaster recovery.
* Flat file cleanup phase 2: make it work for pg_group. The flat groupTom Lane2005-02-203-110/+104
| | | | | | | | | | | file now identifies group members by usesysid not name; this avoids needing to depend on SearchSysCache which we can't use during startup. (The old representation was entirely broken anyway, since we did not regenerate the file following RENAME USER.) It's only a 95% solution because if the group membership list is big enough to be toasted out of line, we cannot read it during startup. I think this will do for the moment, until we have time to implement the planned pg_role replacement for pg_group.
* Add code to prevent transaction ID wraparound by enforcing a safe limitTom Lane2005-02-2011-535/+1099
| | | | | | | | | | | | | | in GetNewTransactionId(). Since the limit value has to be computed before we run any real transactions, this requires adding code to database startup to scan pg_database and determine the oldest datfrozenxid. This can conveniently be combined with the first stage of an attack on the problem that the 'flat file' copies of pg_shadow and pg_group are not properly updated during WAL recovery. The code I've added to startup resides in a new file src/backend/utils/init/flatfiles.c, and it is responsible for rewriting the flat files as well as initializing the XID wraparound limit value. This will eventually allow us to get rid of GetRawDatabaseInfo too, but we'll need an initdb so we can add a trigger to pg_database.
* New arrangement to always let the bgwriter do checkpoints brokeTom Lane2005-02-191-1/+18
| | | | | CHECKPOINT and some other commands in the context of a standalone backend. Allow a standalone backend to do its own checkpoints.
* Ensure that the resolved datatype of any unknown Param is propagatedTom Lane2005-02-191-6/+33
| | | | | into the sub-SELECT targetlist when it appears in the context INSERT INTO foo SELECT $1 ... Per report from Abhijit Menon-Sen.
* Convert MemoryContextSwitchTo() into an inline function when using GCC.Tom Lane2005-02-181-1/+9
|
* Update comment on VACUUM FULL.Bruce Momjian2005-02-151-8/+13
| | | | Manfred Koizar
* Improve documentation of signal usage for HAVE_SIGPROCMASK andBruce Momjian2005-02-141-5/+9
| | | | non-HAVE_SIGPROCMASK cases in pqinitmask().
* Improve documentation of signal usage for HAVE_SIGPROCMASK andBruce Momjian2005-02-141-1/+5
| | | | non-HAVE_SIGPROCMASK cases in pqinitmask().
* ALTER LANGUAGE RENAME has never worked. Per Sergey Yatskevich.Tom Lane2005-02-141-2/+2
|
* Move plpgsql DEBUG from DEBUG2 to DEBUG1 because it is a user-requestedBruce Momjian2005-02-123-8/+8
| | | | | | DEBUG. Fix a few places where DEBUG1 crept in that should have been DEBUG2.
* Adjust input routines for float4, float8 and oid to reject the empty stringNeil Conway2005-02-112-39/+14
| | | | | as valid input (it was previously treated as 0). This input was deprecated in 8.0 (and a warning was emitted). Regression tests updated.
* Fix ANALYZE to accumulate some minimal statistics for an all-null column.Tom Lane2005-02-111-3/+25
| | | | Per gripes from Mike Mascari and Bernd Heller.
* Fix SPI cursor support to allow scanning the results of utility commandsTom Lane2005-02-102-15/+54
| | | | | | that return tuples (such as EXPLAIN). Per gripe from Michael Fuhr. Side effect: fix an old bug that unintentionally disabled backward scans for all SPI-created cursors.
* ALTER TABLE ADD COLUMN exhibits a significant memory leak when adding aNeil Conway2005-02-091-16/+32
| | | | | | | | | | | | | | | | | | | | column with a default expression. In that situation, we need to rewrite the heap relation. To evaluate the new default expression, we use ExecEvalExpr(); however, this can allocate memory in the current memory context, and ATRewriteTable() does not switch out of the active portal's heap memory context. The end result is a rather large memory leak (on the order of gigabytes for a reasonably sized table). This patch changes ATRewriteTable() to switch to the per-tuple memory context before beginning the per-tuple loop. It also removes an explicit heap_freetuple() in the loop, since that is no longer needed. In an unrelated change, I noticed the code was scanning through the attributes of the new tuple descriptor for each tuple of the old table. I changed this to use precomputation, which should slightly speed up the loop. Thanks to steve@deefs.net for reporting the leak.