summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2005-03-07Replace an instance of $Id$ and an instance of $Header$ with $PostgreSQL$Neil Conway
2005-03-07Properly implement "Response files" for bcc. Add URL's to describe theBruce Momjian
feature for Win32 and bcc.
2005-03-07Adjust creation/destruction of TupleDesc data structure to reduce theTom Lane
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.
2005-03-07Rename canonical encodings, per Peter:Bruce Momjian
UNICODE => UTF8 ALT => WIN866 WIN => WIN1251 TCVN => WIN1258 The old codes continue to work.
2005-03-07Here's a tiny fix for a harmless typo in catalog.c:Neil Conway
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
2005-03-06Revise hash join code so that we can increase the number of batchesTom Lane
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).
2005-03-04Replace the BufMgrLock with separate locks on the lookup hashtable andTom Lane
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.
2005-03-02Move snprintf int64 compatibility letters into a NOT_USED block.Bruce Momjian
2005-03-02Fix for %I64d snprintf.Bruce Momjian
2005-03-02snprintf() %I64d code fix.Bruce Momjian
2005-03-02Use our own snprintf() only if NLS is enabled, and support %qd and %I64d.Bruce Momjian
2005-03-02Prevent large allocation in snprintf to hold positional parameters.Bruce Momjian
Allocated size based on format string.
2005-03-02Another go at making pred_test() handle all reasonable combinationsTom Lane
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.
2005-03-02Fix snprintf on Win32:Bruce Momjian
* If vsnprintf() is not before snprintf() in this file, snprintf() * will call the system vsnprintf() on MinGW.
2005-03-02Make port snprintf.c finally thread-safe.Bruce Momjian
2005-03-01Release proclock immediately in RemoveFromWaitQueue() if it representsTom Lane
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.
2005-03-01Allow Trace_lock_oidmin to be set to zero; this is a reasonableTom Lane
representation of not wanting tracing to be limited by object OID.
2005-03-01Make snprintf() use already-defined int64/uint64 typedefs rather thanBruce Momjian
defining its own.
2005-03-01Adjust OR indexscan logic to not generate redundant condition-free ORTom Lane
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.
2005-03-01And while we are on it, I would like to submit minorBruce Momjian
changes to make snprintf() vsnprintf() and printf() functions in src/port/snprintf.c thread-safe. Nicolai Tufar
2005-03-01Revert the logic for expanding AND/OR conditions in pred_test() to whatTom Lane
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.
2005-02-28snprintf.c has no sys/ioctl.h. Trivial patch below:Bruce Momjian
Magnus Hagander
2005-02-28Implement max() and min() aggregates for array types. Patch from KojuNeil Conway
Iijima, reviewed by Neil Conway. Catalog version number bumped, regression tests updated.
2005-02-27Because the change to gettext. Needs a bunch of new includes. PatchBruce Momjian
follows: Magnus Hagander
2005-02-27Tab indent all actions in bcc32.mak, and do it on win32.mak too forBruce Momjian
consistency. Backpatch only bcc32.mak to 8.0.X.
2005-02-27Add explicit casts between int4 and boolean. Patch from Sean Chittenden,Neil Conway
editorializing by Neil Conway. Catalog version bumped.
2005-02-27Cause Win32 to output to the event log rather than stderr by default.Bruce Momjian
Magnus Hagander
2005-02-27Allow Win32 to support the O_SYNC open flag as an wal_sync_method method.Bruce Momjian
Magnus Hagander
2005-02-26Finish up the flat-files project: get rid of GetRawDatabaseInfo() hackTom Lane
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.
2005-02-25In accordance toTeodor Sigaev
http://www.pgsql.ru/db/mw/msg.html?mid=2045361 change TimeATD to/from Datum macros. Re-initdb is needed.
2005-02-25Add linking from /port to bcc makefile.Bruce Momjian
2005-02-24My patch this morning was overly hasty; revert code to original state.Tom Lane
2005-02-23Minor code cleanup: remove a variable that was assigned to but neverNeil Conway
subsequently referenced. Found by: Coverity Fixed by: Sean Chittenden
2005-02-23This patch optimizes the md5_text() function (which is used toNeil Conway
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.
2005-02-23Un-break plpgsql build by removing unwanted _() usage.Tom Lane
This would be a completely inappropriate place to apply localization anyway.
2005-02-23Properly undef _(x) gettext macro.Bruce Momjian
2005-02-22This patch changes makes some significant changes to how compilationNeil Conway
and parsing work in PL/PgSQL: - memory management is now done via palloc(). The compiled representation of each function now has its own memory context. Therefore, the storage consumed by a function can be reclaimed via MemoryContextDelete(). During compilation, the CurrentMemoryContext is the function's memory context. This means that a palloc() is sufficient to allocate memory that will have the same lifetime as the function itself. As a result, code invoked during compilation should be careful to pfree() temporary allocations to avoid leaking memory. Since a lot of the code in the backend is not careful about releasing palloc'ed memory, that means we should switch into a temporary memory context before invoking backend functions. A temporary context appropriate for such allocations is `compile_tmp_cxt'. - The ability to use palloc() allows us to simply a lot of the code in the parser. Rather than representing lists of elements via ad hoc linked lists or arrays, we can use the List type. Rather than doing malloc followed by memset(0), we can just use palloc0(). - We now check that the user has supplied the right number of parameters to a RAISE statement. Supplying either too few or too many results in an error (at runtime). - PL/PgSQL's parser needs to accept arbitrary SQL statements. Since we do not want to duplicate the SQL grammar in the PL/PgSQL grammar, this means we need to be quite lax in what the PL/PgSQL grammar considers a "SQL statement". This can lead to misleading behavior if there is a syntax error in the function definition, since we assume a malformed PL/PgSQL construct is a SQL statement. Furthermore, these errors were only detected at runtime (when we tried to execute the alleged "SQL statement" via SPI). To rectify this, the patch changes the parser to invoke the main SQL parser when it sees a string it believes to be a SQL expression. This means that synctically-invalid SQL will be rejected during the compilation of the PL/PgSQL function. This is only done when compiling for "validation" purposes (i.e. at CREATE FUNCTION time), so it should not impose a runtime overhead. - Fixes for the various buffer overruns I've patched in stable branches in the past few weeks. I've rewritten code where I thought it was warranted (unlike the patches applied to older branches, which were minimally invasive). - Various other minor changes and cleanups. - Updates to the regression tests.
2005-02-22Add semicolon so snprintf.c goto has a statement to attach to:Bruce Momjian
nochar: /* nothing */ ; /* semicolon required because a goto has to be attached to a statement */
2005-02-22Use _() macro consistently rather than gettext(). Add translationBruce Momjian
macros around strings that were missing them.
2005-02-22Add support to port/snprintf.c for position parameter specification:Bruce Momjian
+ # Determine if printf supports %1$ argument selection, e.g. %5$ selects + # the fifth argument after the printf print string. + # This is not in the C99 standard, but in the Single Unix Specification (SUS). + # It is used in our langauge translation strings. Nicolai Tufar with configure changes by Bruce.
2005-02-21Try to get Borland CC to compile.Bruce Momjian
Backpatch to 8.0.X which doesn't work right now.
2005-02-21Trivial fix: change the reference to further documentation of pathkeys toNeil Conway
point to its new location.
2005-02-20Use SnapshotNow instead of SnapshotSelf for reading the catalogsTom Lane
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.
2005-02-20Remove some no-longer-needed kluges for bootstrapping, in particularTom Lane
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.
2005-02-20Rename macro to MAKE_EXPIRED_TUPLES_VISIBLE.Bruce Momjian
2005-02-20Fix MAKE_ALL_TUPLES_VISIBLE define.Bruce Momjian
2005-02-20Move define MAKE_ALL_TUPLES_VISIBLE to a more logical place.Bruce Momjian
2005-02-20I have added a define, MAKE_ALL_TUPLES_VISIBLE, to help people recoverBruce Momjian
deleted tuples. Of course it is only to be used for disaster recovery.
2005-02-20Flat file cleanup phase 2: make it work for pg_group. The flat groupTom Lane
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.
2005-02-20Add code to prevent transaction ID wraparound by enforcing a safe limitTom Lane
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.