]> granicus.if.org Git - postgresql/log
postgresql
14 years agoIntroduce WAL records to log reuse of btree pages, allowing conflict
Simon Riggs [Sat, 13 Feb 2010 00:59:58 +0000 (00:59 +0000)]
Introduce WAL records to log reuse of btree pages, allowing conflict
resolution during Hot Standby. Page reuse interlock requested by Tom.
Analysis and patch by me.

14 years agoTweak the order of processing of WITH clauses so that they are processed
Tom Lane [Fri, 12 Feb 2010 22:48:56 +0000 (22:48 +0000)]
Tweak the order of processing of WITH clauses so that they are processed
before we start analyzing the parent statement.  This is to make it
more clear that the WITH isn't affected by anything in the parent.
I don't believe there's any actual bug here, because the stuff that
was being done before WITH didn't affect subqueries; but it's certainly
a potential for error (and apparently misled Marko into committing some
real errors...).

14 years agoAdd regression test files inadvertantly omitted in plperl.on_plperl{u}_init patch
Andrew Dunstan [Fri, 12 Feb 2010 19:38:14 +0000 (19:38 +0000)]
Add regression test files inadvertantly omitted in plperl.on_plperl{u}_init patch

14 years agoDon't choke when exec_move_row assigns a synthesized null to a column
Tom Lane [Fri, 12 Feb 2010 19:37:36 +0000 (19:37 +0000)]
Don't choke when exec_move_row assigns a synthesized null to a column
that happens to be composite itself.  Per bug #5314 from Oleg Serov.

Backpatch to 8.0 --- 7.4 has got too many other shortcomings in
composite-type support to make this worth worrying about in that branch.

14 years agoAdd plperl.on_plperl_init and plperl.on_plperlu_init settings for language-specific...
Andrew Dunstan [Fri, 12 Feb 2010 19:35:25 +0000 (19:35 +0000)]
Add plperl.on_plperl_init and plperl.on_plperlu_init settings for language-specific startup. Rename recently added plperl.on_perl_init to plperl.on_init. Also, code cleanup for utf8 hack. Patch from Tim Bunce, reviewed by Alex Hunsaker.

14 years agoExtend the set of frame options supported for window functions.
Tom Lane [Fri, 12 Feb 2010 17:33:21 +0000 (17:33 +0000)]
Extend the set of frame options supported for window functions.

This patch allows the frame to start from CURRENT ROW (in either RANGE or
ROWS mode), and it also adds support for ROWS n PRECEDING and ROWS n FOLLOWING
start and end points.  (RANGE value PRECEDING/FOLLOWING isn't there yet ---
the grammar works, but that's all.)

Hitoshi Harada, reviewed by Pavel Stehule

14 years agoUpdate Hot Standby documentation to reflect the change in the LOG
Heikki Linnakangas [Fri, 12 Feb 2010 14:53:22 +0000 (14:53 +0000)]
Update Hot Standby documentation to reflect the change in the LOG
messages printed at startup. As pointed out by Simon Riggs.

14 years agoReduce the chatter to the log when starting a standby server. Don't
Heikki Linnakangas [Fri, 12 Feb 2010 09:49:08 +0000 (09:49 +0000)]
Reduce the chatter to the log when starting a standby server. Don't
echo all the recovery.conf options. Don't emit the "initializing
recovery connections" message, which doesn't mean anything to a user.
Remove the "starting archive recovery" message and replace the
"automatic recovery in progress" message with a more informative message
saying whether the server is doing PITR, normal archive recovery, or
standby mode.

14 years agoClean up Streaming Replication documentation a little bit. A lot more
Heikki Linnakangas [Fri, 12 Feb 2010 08:28:44 +0000 (08:28 +0000)]
Clean up Streaming Replication documentation a little bit. A lot more
needs to be done, but it's a step forward..

14 years agoIf primary_conninfo is not set, don't try to establish streaming
Heikki Linnakangas [Fri, 12 Feb 2010 07:56:36 +0000 (07:56 +0000)]
If primary_conninfo is not set, don't try to establish streaming
connection.

14 years agoCheck for partial WAL files in standby mode. If restore_command restores
Heikki Linnakangas [Fri, 12 Feb 2010 07:36:44 +0000 (07:36 +0000)]
Check for partial WAL files in standby mode. If restore_command restores
a partial WAL file, assume it's because the file is just being copied to
the archive and treat it the same as "file not found" in standby mode.
pg_standby has a similar check, so it seems reasonable to have the same
level of protection in the built-in standby mode.

14 years agoFree reference in correct Perl context. Backpatch to release 8.2. Patch from Tim...
Andrew Dunstan [Fri, 12 Feb 2010 04:31:14 +0000 (04:31 +0000)]
Free reference in correct Perl context. Backpatch to release 8.2. Patch from Tim Bunce.

14 years agoSuppress uninitialized-variable warning.
Tom Lane [Thu, 11 Feb 2010 22:17:27 +0000 (22:17 +0000)]
Suppress uninitialized-variable warning.

14 years agoFix typo bug in Hot Standby from recent refactoring. Bug introduced
Simon Riggs [Thu, 11 Feb 2010 19:35:22 +0000 (19:35 +0000)]
Fix typo bug in Hot Standby from recent refactoring. Bug introduced
into code recently patched by Andres Freund, so quickly fixed by him
when bug report from Tatsuo Ishii arrived.

14 years agoGeneric implementation of red-black binary tree. It's planned to use in
Teodor Sigaev [Thu, 11 Feb 2010 14:29:50 +0000 (14:29 +0000)]
Generic implementation of red-black binary tree. It's planned to use in
several places, but for now only GIN uses it during index creation.
Using self-balanced tree greatly speeds up index creation in corner cases
with preordered data.

14 years agoNow that streaming replication switches between streaming mode and
Heikki Linnakangas [Wed, 10 Feb 2010 08:25:25 +0000 (08:25 +0000)]
Now that streaming replication switches between streaming mode and
restoring from archive, the last WAL segment is not necessarily open at
the end of recovery. Fix assertion that assumed that.

Fujii Masao, fixing the assertion failure reported by Martin Pihlak.

14 years agoImprove planner's choices about when to use hashing vs sorting for DISTINCT.
Tom Lane [Wed, 10 Feb 2010 03:38:35 +0000 (03:38 +0000)]
Improve planner's choices about when to use hashing vs sorting for DISTINCT.

The previous coding missed a bet by sometimes picking the "sorted" path
from query_planner even though hashing would be preferable.  To fix, we have
to be willing to make the choice sooner.  This contorts things a little bit,
but I thought of a factorization that makes it not too awful.

14 years agoFix up rickety handling of relation-truncation interlocks.
Tom Lane [Tue, 9 Feb 2010 21:43:30 +0000 (21:43 +0000)]
Fix up rickety handling of relation-truncation interlocks.

Move rd_targblock, rd_fsm_nblocks, and rd_vm_nblocks from relcache to the smgr
relation entries, so that they will get reset to InvalidBlockNumber whenever
an smgr-level flush happens.  Because we now send smgr invalidation messages
immediately (not at end of transaction) when a relation truncation occurs,
this ensures that other backends will reset their values before they next
access the relation.  We no longer need the unreliable assumption that a
VACUUM that's doing a truncation will hold its AccessExclusive lock until
commit --- in fact, we can intentionally release that lock as soon as we've
completed the truncation.  This patch therefore reverts (most of) Alvaro's
patch of 2009-11-10, as well as my marginal hacking on it yesterday.  We can
also get rid of assorted no-longer-needed relcache flushes, which are far more
expensive than an smgr flush because they kill a lot more state.

In passing this patch fixes smgr_redo's failure to perform visibility-map
truncation, and cleans up some rather dubious assumptions in freespace.c and
visibilitymap.c about when rd_fsm_nblocks and rd_vm_nblocks can be out of
date.

14 years agoFix bug in GIN WAL redo cleanup function: don't free fake relcache entry
Heikki Linnakangas [Tue, 9 Feb 2010 20:31:24 +0000 (20:31 +0000)]
Fix bug in GIN WAL redo cleanup function: don't free fake relcache entry
while it's still being used.

Backpatch to 8.4, where the fake relcache method was introduced.

14 years agoTypo fix, per Thom Brown
Magnus Hagander [Tue, 9 Feb 2010 20:22:20 +0000 (20:22 +0000)]
Typo fix, per Thom Brown

14 years agoDefine the value for in6addr_any on MingW, since it provides the struct
Magnus Hagander [Tue, 9 Feb 2010 19:55:14 +0000 (19:55 +0000)]
Define the value for in6addr_any on MingW, since it provides the struct
only in the header files and not in any libraries, yet declare it as
an extern.

14 years agoMove "Warm Standby Servers for High Availability" and "Hot Standby"
Heikki Linnakangas [Tue, 9 Feb 2010 16:50:25 +0000 (16:50 +0000)]
Move "Warm Standby Servers for High Availability" and "Hot Standby"
sections under "High Availability, Load Balancing, and Replication"
chapter. Streaming replication chapter needs a lot more work, but this
commit just moves things around.

14 years agoFirst try to make this one ecpg regression test work on Windows too. I'm just trying...
Michael Meskes [Tue, 9 Feb 2010 08:57:13 +0000 (08:57 +0000)]
First try to make this one ecpg regression test work on Windows too. I'm just trying to figure out the minimal amount of defines needed.

14 years agoAllow free space map vacuuming to be interrupted.
Tom Lane [Tue, 9 Feb 2010 00:28:57 +0000 (00:28 +0000)]
Allow free space map vacuuming to be interrupted.

14 years agoRearrange lazy-vacuum code a little bit to reduce the window between
Tom Lane [Tue, 9 Feb 2010 00:28:30 +0000 (00:28 +0000)]
Rearrange lazy-vacuum code a little bit to reduce the window between
truncating the table and transaction commit.  This isn't really making
it safe, but at least there is no good reason to do free space map
cleanup within the risk window.  Don't lock out cancel interrupts
until we have to, either.

14 years agoCreate an official API function for C functions to use to check if they are
Tom Lane [Mon, 8 Feb 2010 20:39:52 +0000 (20:39 +0000)]
Create an official API function for C functions to use to check if they are
being called as aggregates, and to get the aggregate transition state memory
context if needed.  Use it instead of poking directly into AggState and
WindowAggState in places that shouldn't know so much.

We should have done this in 8.4, probably, but better late than never.

Revised version of a patch by Hitoshi Harada.

14 years agoRemove obsolete comment about 'fsm' argument, which isn't an argument
Heikki Linnakangas [Mon, 8 Feb 2010 19:59:49 +0000 (19:59 +0000)]
Remove obsolete comment about 'fsm' argument, which isn't an argument
anymore.

14 years agoFix serious performance bug in new implementation of VACUUM FULL:
Tom Lane [Mon, 8 Feb 2010 16:50:21 +0000 (16:50 +0000)]
Fix serious performance bug in new implementation of VACUUM FULL:
cluster_rel necessarily builds an all-new toast table, so it's useless to
then go and VACUUM FULL the toast table.

14 years agoAdd C comments that HEAP_MOVED_* define usage is only for pre-9.0 binary
Bruce Momjian [Mon, 8 Feb 2010 14:10:21 +0000 (14:10 +0000)]
Add C comments that HEAP_MOVED_* define usage is only for pre-9.0 binary
upgrades.

14 years agoUpdate high availability/replication documentation chart for new hot
Bruce Momjian [Mon, 8 Feb 2010 13:41:06 +0000 (13:41 +0000)]
Update high availability/replication documentation chart for new hot
standby featureset.

14 years agoRemove piece of code to zero out minRecoveryPoint when starting crash
Heikki Linnakangas [Mon, 8 Feb 2010 09:08:51 +0000 (09:08 +0000)]
Remove piece of code to zero out minRecoveryPoint when starting crash
recovery. It's zeroed out whenever a checkpoint is written, so the only
scenario where the removed code did anything is when you kill archive
recovery, remove recovery.conf, and start up the server, so that it goes
into crash recovery instead. That's a "don't do that" scenario, but it
seems better to not clear minRecoveryPoint but instead update it like we
do in archive recovery, which is what will now happen.

14 years agoRemove CatalogCacheFlushRelation, and the reloidattr infrastructure that was
Tom Lane [Mon, 8 Feb 2010 05:53:55 +0000 (05:53 +0000)]
Remove CatalogCacheFlushRelation, and the reloidattr infrastructure that was
needed by nothing else.

The restructuring I just finished doing on cache management exposed to me how
silly this routine was.  Its function was to go into the catcache and blow
away all entries related to a given relation when there was a relcache flush
on that relation.  However, there is no point in removing a catcache entry
if the catalog row it represents is still valid --- and if it isn't valid,
there must have been a catcache entry flush on it, because that's triggered
directly by heap_update or heap_delete on the catalog row.  So this routine
accomplished nothing except to blow away valid cache entries that we'd very
likely be wanting in the near future to help reconstruct the relcache entry.
Dumb.

On top of which, it required a subtle and easy-to-get-wrong attribute in
syscache definitions, ie, the column containing the OID of the related
relation if any.  Removing that is a very useful maintenance simplification.

14 years agoRemove some more dead VACUUM-FULL-only code.
Tom Lane [Mon, 8 Feb 2010 05:17:31 +0000 (05:17 +0000)]
Remove some more dead VACUUM-FULL-only code.

14 years agoRemove old-style VACUUM FULL (which was known for a little while as
Tom Lane [Mon, 8 Feb 2010 04:33:55 +0000 (04:33 +0000)]
Remove old-style VACUUM FULL (which was known for a little while as
VACUUM FULL INPLACE), along with a boatload of subsidiary code and complexity.
Per discussion, the use case for this method of vacuuming is no longer large
enough to justify maintaining it; not to mention that we don't wish to invest
the work that would be needed to make it play nicely with Hot Standby.

Aside from the code directly related to old-style VACUUM FULL, this commit
removes support for certain WAL record types that could only be generated
within VACUUM FULL, redirect-pointer removal in heap_page_prune, and
nontransactional generation of cache invalidation sinval messages (the last
being the sticking point for Hot Standby).

We still have to retain all code that copes with finding HEAP_MOVED_OFF and
HEAP_MOVED_IN flag bits on existing tuples.  This can't be removed as long
as we want to support in-place update from pre-9.0 databases.

14 years agoWork around deadlock problems with VACUUM FULL/CLUSTER on system catalogs,
Tom Lane [Sun, 7 Feb 2010 22:40:33 +0000 (22:40 +0000)]
Work around deadlock problems with VACUUM FULL/CLUSTER on system catalogs,
as per my recent proposal.

First, teach IndexBuildHeapScan to not wait for INSERT_IN_PROGRESS or
DELETE_IN_PROGRESS tuples to commit unless the index build is checking
uniqueness/exclusion constraints.  If it isn't, there's no harm in just
indexing the in-doubt tuple.

Second, modify VACUUM FULL/CLUSTER to suppress reverifying
uniqueness/exclusion constraint properties while rebuilding indexes of
the target relation.  This is reasonable because these commands aren't
meant to deal with corrupted-data situations.  Constraint properties
will still be rechecked when an index is rebuilt by a REINDEX command.

This gets us out of the problem that new-style VACUUM FULL would often
wait for other transactions while holding exclusive lock on a system
catalog, leading to probable deadlock because those other transactions
need to look at the catalogs too.  Although the real ultimate cause of
the problem is a debatable choice to release locks early after modifying
system catalogs, changing that choice would require pretty serious
analysis and is not something to be undertaken lightly or on a tight
schedule.  The present patch fixes the problem in a fairly reasonable
way and should also improve the speed of VACUUM FULL/CLUSTER a little bit.

14 years agoLooks like we need #include <sys/stat.h> here on some
Tom Lane [Sun, 7 Feb 2010 22:00:53 +0000 (22:00 +0000)]
Looks like we need #include <sys/stat.h> here on some
platforms.  Per buildfarm.

14 years agoCreate a "relation mapping" infrastructure to support changing the relfilenodes
Tom Lane [Sun, 7 Feb 2010 20:48:13 +0000 (20:48 +0000)]
Create a "relation mapping" infrastructure to support changing the relfilenodes
of shared or nailed system catalogs.  This has two key benefits:

* The new CLUSTER-based VACUUM FULL can be applied safely to all catalogs.

* We no longer have to use an unsafe reindex-in-place approach for reindexing
  shared catalogs.

CLUSTER on nailed catalogs now works too, although I left it disabled on
shared catalogs because the resulting pg_index.indisclustered update would
only be visible in one database.

Since reindexing shared system catalogs is now fully transactional and
crash-safe, the former special cases in REINDEX behavior have been removed;
shared catalogs are treated the same as non-shared.

This commit does not do anything about the recently-discussed problem of
deadlocks between VACUUM FULL/CLUSTER on a system catalog and other
concurrent queries; will address that in a separate patch.  As a stopgap,
parallel_schedule has been tweaked to run vacuum.sql by itself, to avoid
such failures during the regression tests.

14 years agoAvoid changing the sign of zero. Per buildfarm failures.
Tom Lane [Sat, 6 Feb 2010 05:42:49 +0000 (05:42 +0000)]
Avoid changing the sign of zero.  Per buildfarm failures.

14 years agoMention warm and now "hot" standby servers in the high availability docs.
Bruce Momjian [Fri, 5 Feb 2010 23:53:22 +0000 (23:53 +0000)]
Mention warm and now "hot" standby servers in the high availability docs.

14 years agoDocument that archive_timeout will force new WAL files even if a single
Bruce Momjian [Fri, 5 Feb 2010 23:37:43 +0000 (23:37 +0000)]
Document that archive_timeout will force new WAL files  even if a single
checkpoint has happened, and recommend adjusting checkpoint_timeout to
reduce the impact of this.

14 years agoAdd C comment about process_settings() setting order.
Bruce Momjian [Fri, 5 Feb 2010 20:26:56 +0000 (20:26 +0000)]
Add C comment about process_settings() setting order.

14 years agoPrevious commit was: Properly document that OVER and WINDOW are Postgres reserved...
Bruce Momjian [Fri, 5 Feb 2010 19:38:21 +0000 (19:38 +0000)]
Previous commit was:  Properly document that OVER and WINDOW are Postgres reserved words.

14 years agoPrevious commit was to have tab checking as part of gmake check.
Bruce Momjian [Fri, 5 Feb 2010 19:31:18 +0000 (19:31 +0000)]
Previous commit was to have tab checking as part of gmake check.

14 years ago*** empty log message ***
Bruce Momjian [Fri, 5 Feb 2010 19:28:39 +0000 (19:28 +0000)]
*** empty log message ***

14 years agoImprove PL/Perl documentation of database access functions.
Bruce Momjian [Fri, 5 Feb 2010 18:11:46 +0000 (18:11 +0000)]
Improve PL/Perl documentation of database access functions.

Alexey Klyukin

14 years agoAdd SGML 'check-tabs' Makefile rule to check for tabs.
Bruce Momjian [Fri, 5 Feb 2010 14:51:50 +0000 (14:51 +0000)]
Add SGML 'check-tabs' Makefile rule to check for tabs.

14 years agoRemove /contrib/isn copyright mention for German Mendez Bravo, with
Bruce Momjian [Fri, 5 Feb 2010 04:34:51 +0000 (04:34 +0000)]
Remove /contrib/isn copyright mention for German Mendez Bravo, with
author's permission.

14 years agoRewrite rint() to enable removal of copyright mention; patch from
Bruce Momjian [Fri, 5 Feb 2010 03:20:56 +0000 (03:20 +0000)]
Rewrite rint() to enable removal of copyright mention;  patch from
Nathan Wagner

Function is simpler too.

14 years agoModify recently added PQconnectdbParams() with new argument, expand_dbname.
Joe Conway [Fri, 5 Feb 2010 03:09:05 +0000 (03:09 +0000)]
Modify recently added PQconnectdbParams() with new argument, expand_dbname.
If expand_dbname is non-zero and dbname contains an = sign, it is taken as
a conninfo string in exactly the same way as if it had been passed to
PQconnectdb. This is equivalent to the way PQsetdbLogin() works, allowing
PQconnectdbParams() to be a complete alternative.

Also improve the way the new function is called from psql and replace a
previously missed call to PQsetdbLogin() in psql. Additionally use
PQconnectdbParams() for pg_dump and friends, and the bin/scripts
command line utilities such as vacuumdb, createdb, etc.

Finally, update the documentation for the new parameter, as well as the
nuances of precedence in cases where key words are repeated or duplicated
in the conninfo string.

14 years agoRewrite intagg/Makefile from scratch, to avoid copyright mention.
Bruce Momjian [Fri, 5 Feb 2010 03:06:30 +0000 (03:06 +0000)]
Rewrite intagg/Makefile from scratch, to avoid copyright mention.

14 years agoUsage of isnan() in ECPG regression tests probably needs '#include <float.h>' as...
Michael Meskes [Thu, 4 Feb 2010 11:23:29 +0000 (11:23 +0000)]
Usage of isnan() in ECPG regression tests probably needs '#include <float.h>' as well.

14 years agoStreamlined array handling code in libecpg a little bit, in the process fixing yet...
Michael Meskes [Thu, 4 Feb 2010 09:41:35 +0000 (09:41 +0000)]
Streamlined array handling code in libecpg a little bit, in the process fixing yet another incorrect log output.

14 years agoThree out of four of us like this phrasing better.
Tom Lane [Thu, 4 Feb 2010 00:19:28 +0000 (00:19 +0000)]
Three out of four of us like this phrasing better.

14 years agoRestructure CLUSTER/newstyle VACUUM FULL/ALTER TABLE support so that swapping
Tom Lane [Thu, 4 Feb 2010 00:09:14 +0000 (00:09 +0000)]
Restructure CLUSTER/newstyle VACUUM FULL/ALTER TABLE support so that swapping
of old and new toast tables can be done either at the logical level (by
swapping the heaps' reltoastrelid links) or at the physical level (by swapping
the relfilenodes of the toast tables and their indexes).  This is necessary
infrastructure for upcoming changes to support CLUSTER/VAC FULL on shared
system catalogs, where we cannot change reltoastrelid.  The physical swap
saves a few catalog updates too.

We unfortunately have to keep the logical-level swap logic because in some
cases we will be adding or deleting a toast table, so there's no possibility
of a physical swap.  However, that only happens as a consequence of schema
changes in the table, which we do not need to support for system catalogs,
so such cases aren't an obstacle for that.

In passing, refactor the cluster support functions a little bit to eliminate
unnecessarily-duplicated code; and fix the problem that while CLUSTER had
been taught to rename the final toast table at need, ALTER TABLE had not.

14 years agoCheck to ensure the number of primary key fields supplied does not
Joe Conway [Wed, 3 Feb 2010 23:01:11 +0000 (23:01 +0000)]
Check to ensure the number of primary key fields supplied does not
exceed the total number of non-dropped source table fields for
dblink_build_sql_*(). Addresses bug report from Rushabh Lathia.

Backpatch all the way to the 7.3 branch.

14 years agoMention "unquoted" identifiers are case-insensitive.
Bruce Momjian [Wed, 3 Feb 2010 22:48:55 +0000 (22:48 +0000)]
Mention "unquoted" identifiers are case-insensitive.

14 years agoProofreading improvements for the Administration documentation book.
Bruce Momjian [Wed, 3 Feb 2010 17:25:06 +0000 (17:25 +0000)]
Proofreading improvements for the Administration documentation book.

14 years agoFixed some typos in ECPG regression test suite that resulted in regression test failu...
Michael Meskes [Wed, 3 Feb 2010 13:56:27 +0000 (13:56 +0000)]
Fixed some typos in ECPG regression test suite that resulted in regression test failures on some architectures.

By Zoltán Böszörményi.

14 years agoMove the responsibility of writing a "unlogged WAL operation" record from
Heikki Linnakangas [Wed, 3 Feb 2010 10:01:30 +0000 (10:01 +0000)]
Move the responsibility of writing a "unlogged WAL operation" record from
heap_sync() to the callers, because heap_sync() is sometimes called even
if the operation itself is WAL-logged. This eliminates the bogus unlogged
records from CLUSTER that Simon Riggs reported, patch by Fujii Masao.

14 years agoAdd a message type header to the CopyData messages sent from primary
Heikki Linnakangas [Wed, 3 Feb 2010 09:47:19 +0000 (09:47 +0000)]
Add a message type header to the CopyData messages sent from primary
to standby in streaming replication. While we only have one message type
at the moment, adding a message type header makes this easier to extend.

14 years agoFix unwarranted assumption that a cached rowtype would stick around
Tom Lane [Wed, 3 Feb 2010 05:46:37 +0000 (05:46 +0000)]
Fix unwarranted assumption that a cached rowtype would stick around
for the lifespan of the CreateStmt.  Per buildfarm member jaguar.

14 years agoAdd #include <float.h> --- guessing the lack of this is why Windows
Tom Lane [Wed, 3 Feb 2010 03:25:55 +0000 (03:25 +0000)]
Add #include <float.h> --- guessing the lack of this is why Windows
machines are all rejecting isinf() calls in this file.

14 years agoFix timing-sensitive regression test result I just created :-( --- the
Tom Lane [Wed, 3 Feb 2010 03:21:25 +0000 (03:21 +0000)]
Fix timing-sensitive regression test result I just created :-( --- the
DROP USER at the end of the cluster.sql test could fail, if the temp
table created in the previous session hadn't finished getting dropped.
Unluckily, I didn't see this in several repetitions of the parallel
regression tests, but it's popping up on quite a few buildfarm machines.

14 years agoAssorted cleanups in preparation for using a map file to support altering
Tom Lane [Wed, 3 Feb 2010 01:14:17 +0000 (01:14 +0000)]
Assorted cleanups in preparation for using a map file to support altering
the relfilenode of currently-not-relocatable system catalogs.

1. Get rid of inval.c's dependency on relfilenode, by not having it emit
smgr invalidations as a result of relcache flushes.  Instead, smgr sinval
messages are sent directly from smgr.c when an actual relation delete or
truncate is done.  This makes considerably more structural sense and allows
elimination of a large number of useless smgr inval messages that were
formerly sent even in cases where nothing was changing at the
physical-relation level.  Note that this reintroduces the concept of
nontransactional inval messages, but that's okay --- because the messages
are sent by smgr.c, they will be sent in Hot Standby slaves, just from a
lower logical level than before.

2. Move setNewRelfilenode out of catalog/index.c, where it never logically
belonged, into relcache.c; which is a somewhat debatable choice as well but
better than before.  (I considered catalog/storage.c, but that seemed too
low level.)  Rename to RelationSetNewRelfilenode.

3. Cosmetic cleanups of some other relfilenode manipulations.

14 years agoFix assorted poorly-thought-out message strings: use %u not %d for printing
Tom Lane [Tue, 2 Feb 2010 22:01:53 +0000 (22:01 +0000)]
Fix assorted poorly-thought-out message strings: use %u not %d for printing
OIDs, avoid random line breaks in strings somebody might grep for.

14 years agoCLUSTER specified the wrong namespace when renaming toast tables of temporary
Tom Lane [Tue, 2 Feb 2010 19:12:29 +0000 (19:12 +0000)]
CLUSTER specified the wrong namespace when renaming toast tables of temporary
relations (they don't live in pg_toast).  This caused an Assert failure in
assert-enabled builds.  So far as I can see, in a non-assert build it would
only have messed up the checks for conflicting names, so a failure would be
quite improbable but perhaps not impossible.

14 years agoMake RADIUS authentication use pg_getaddrinfo_all() to get address of
Magnus Hagander [Tue, 2 Feb 2010 19:09:37 +0000 (19:09 +0000)]
Make RADIUS authentication use pg_getaddrinfo_all() to get address of
the server.

Gets rid of a fairly ugly hack for Solaris, and also provides hostname
and IPV6 support.

14 years agoFold FindConversion() into FindConversionByName() and remove ACL check.
Robert Haas [Tue, 2 Feb 2010 18:52:33 +0000 (18:52 +0000)]
Fold FindConversion() into FindConversionByName() and remove ACL check.

All callers of FindConversionByName() already do suitable permissions
checking already apart from this function, but this is not just dead
code removal: the unnecessary permissions check can actually lead to
spurious failures - there's no reason why inability to execute the
underlying function should prohibit renaming the conversion, for example.
(The error messages in these cases were also rather poor:
FindConversion would return InvalidOid, eventually leading to a complaint
that the conversion "did not exist", which was not correct.)

KaiGai Kohei

14 years agoRemove copyright mention of Andrew Yu, per author's permission.
Bruce Momjian [Tue, 2 Feb 2010 18:52:02 +0000 (18:52 +0000)]
Remove copyright mention of Andrew Yu, per author's permission.

Backpatch to 8.4.X.

14 years agoThe particular table names used in the new inheritance regression test are
Tom Lane [Tue, 2 Feb 2010 18:16:10 +0000 (18:16 +0000)]
The particular table names used in the new inheritance regression test are
prone to sort differently in different locales, as seen in buildfarm results.
Let's cast to name not text to avoid that.

14 years agoFixed NaN/Infinity problems in ECPG for float/double/numeric/decimal by making it...
Michael Meskes [Tue, 2 Feb 2010 16:09:12 +0000 (16:09 +0000)]
Fixed NaN/Infinity problems in ECPG for float/double/numeric/decimal by making it OS independant.

Patch done by Zoltán Böszörményi.

14 years agoTighten integrity checks on ALTER TABLE ... ALTER COLUMN ... RENAME.
Robert Haas [Mon, 1 Feb 2010 19:28:56 +0000 (19:28 +0000)]
Tighten integrity checks on ALTER TABLE ... ALTER COLUMN ... RENAME.

When a column is renamed, we recursively rename the same column in
all descendent tables.  But if one of those tables also inherits that
column from a table outside the inheritance hierarchy rooted at the
named table, we must throw an error.  The previous coding correctly
prohibited the rename when the parent had inherited the column from
elsewhere, but overlooked the case where the parent was OK but a child
table also inherited the same column from a second, unrelated parent.

For now, not backpatched due to lack of complaints from the field.

KaiGai Kohei, with further changes by me.
Reviewed by Bernd Helme and Tom Lane.

14 years agoRemove tabs in sgml.
Bruce Momjian [Mon, 1 Feb 2010 15:48:35 +0000 (15:48 +0000)]
Remove tabs in sgml.

14 years agoAugment EXPLAIN output with more details on Hash nodes.
Robert Haas [Mon, 1 Feb 2010 15:43:36 +0000 (15:43 +0000)]
Augment EXPLAIN output with more details on Hash nodes.

We show the number of buckets, the number of batches (and also the original
number if it has changed), and the peak space used by the hash table.  Minor
executor changes to track peak space used.

14 years agoMinor documentation improvements for new string_agg aggregate.
Robert Haas [Mon, 1 Feb 2010 15:38:21 +0000 (15:38 +0000)]
Minor documentation improvements for new string_agg aggregate.

14 years agoRevoke augmentation of WAL records for btree delete, per discussion.
Simon Riggs [Mon, 1 Feb 2010 13:40:28 +0000 (13:40 +0000)]
Revoke augmentation of WAL records for btree delete, per discussion.

14 years agoAdd string_agg aggregate functions. The one argument version concatenates
Itagaki Takahiro [Mon, 1 Feb 2010 03:14:45 +0000 (03:14 +0000)]
Add string_agg aggregate functions. The one argument version concatenates
the input values into a string. The two argument version also does the same
thing, but inserts delimiters between elements.

Original patch by Pavel Stehule, reviewed by David E. Wheeler and me.

14 years agoChange regexp engine's ccondissect/crevdissect routines to perform DFA
Tom Lane [Mon, 1 Feb 2010 02:45:29 +0000 (02:45 +0000)]
Change regexp engine's ccondissect/crevdissect routines to perform DFA
matching before recursing instead of after.  The DFA match eliminates
unworkable midpoint choices a lot faster than the recursive check, in most
cases, so doing it first can speed things up; particularly in pathological
cases such as recently exhibited by Michael Glaesemann.

In addition, apply some cosmetic changes that were applied upstream (in the
Tcl project) at the same time, in order to sync with upstream version 1.15
of regexec.c.

Upstream apparently intends to backpatch this, so I will too.  The
pathological behavior could be unpleasant if encountered in the field,
which seems to justify any risk of introducing new bugs.

Tom Lane, reviewed by Donal K. Fellows of Tcl project

14 years agoDetect early deadlock in Hot Standby when Startup is already waiting. First
Simon Riggs [Sun, 31 Jan 2010 19:01:11 +0000 (19:01 +0000)]
Detect early deadlock in Hot Standby when Startup is already waiting. First
stage of required deadlock detection to allow re-enabling max_standby_delay
setting of -1, which is now essential in the absence of improved relation-
specific conflict resoluton. Requested by Greg Stark et al.

14 years agoFix memory leak created by deferrable-index-constraints patches.
Tom Lane [Sun, 31 Jan 2010 18:15:39 +0000 (18:15 +0000)]
Fix memory leak created by deferrable-index-constraints patches.

We need to free the OID list returned by ExecInsertIndexTuples to avoid
a query-lifespan memory leak.  When many rows require rechecking, this
can be a significant leak --- it's even more than the space used for the
queued trigger events.

Dean Rasheed

14 years agoMake checks for invalid pgStatSock use PGINVALID_SOCKET
Magnus Hagander [Sun, 31 Jan 2010 17:39:34 +0000 (17:39 +0000)]
Make checks for invalid pgStatSock use PGINVALID_SOCKET

14 years agoParenthesize this macro, just in case.
Tom Lane [Sun, 31 Jan 2010 17:35:46 +0000 (17:35 +0000)]
Parenthesize this macro, just in case.

14 years agoGet rid of unportable use of socklen_t --- we have a configure test
Tom Lane [Sun, 31 Jan 2010 17:27:22 +0000 (17:27 +0000)]
Get rid of unportable use of socklen_t --- we have a configure test
for that, so use it.

14 years agoRemove now unnecessary loop around CallNamedPipe().
Magnus Hagander [Sun, 31 Jan 2010 17:18:28 +0000 (17:18 +0000)]
Remove now unnecessary loop around CallNamedPipe().

Radu Ilie

14 years agoFix race condition in win32 signal handling.
Magnus Hagander [Sun, 31 Jan 2010 17:16:23 +0000 (17:16 +0000)]
Fix race condition in win32 signal handling.

There was a race condition where the receiving pipe could be closed by the
child thread if the main thread was pre-empted before it got a chance to
create a new one, and the dispatch thread ran to completion during that time.

One symptom of this is that rows in pg_listener could be dropped under
heavy load.

Analysis and original patch by Radu Ilie, with some small
modifications by Magnus Hagander.

14 years agoAvoid performing encoding conversion on command tag strings during EndCommand.
Tom Lane [Sat, 30 Jan 2010 20:09:53 +0000 (20:09 +0000)]
Avoid performing encoding conversion on command tag strings during EndCommand.

Since all current and foreseeable future command tags will be pure ASCII,
there is no need to do conversion on them.  This saves a few cycles and also
avoids polluting otherwise-pristine subtransaction memory contexts, which
is the cause of the backend memory leak exhibited in bug #5302.  (Someday
we'll probably want to have a better method of determining whether
subtransaction contexts need to be kept around, but today is not that day.)

Backpatch to 8.0.  The cycle-shaving aspect of this would work in 7.4
too, but without subtransactions the memory-leak aspect doesn't apply,
so it doesn't seem worth touching 7.4.

14 years agoFix memory leakage introduced into print_aligned_text by 8.4 changes
Tom Lane [Sat, 30 Jan 2010 18:59:51 +0000 (18:59 +0000)]
Fix memory leakage introduced into print_aligned_text by 8.4 changes
(failure to free col_lineptrs[] array elements) and exacerbated in the
current devel cycle (failure to free "wrap").  This resulted in moderate
bloat of psql over long script runs.  Noted while testing bug #5302,
although what the reporter was complaining of was backend-side leakage.

14 years agoFix some comments that got mangled by pgindent.
Tom Lane [Sat, 30 Jan 2010 04:18:00 +0000 (04:18 +0000)]
Fix some comments that got mangled by pgindent.

14 years agoAdd plperl.on_perl_init setting to provide for initializing the perl library on load...
Andrew Dunstan [Sat, 30 Jan 2010 01:46:57 +0000 (01:46 +0000)]
Add plperl.on_perl_init setting to provide for initializing the perl library on load. Also, handle END blocks in plperl.
Database access is disallowed during both these operations, although it might be allowed in END blocks in future.

Patch from Tim Bunce.

14 years agoAdjust GetLockConflicts() so that it uses TopMemoryContext when
Simon Riggs [Fri, 29 Jan 2010 19:45:12 +0000 (19:45 +0000)]
Adjust GetLockConflicts() so that it uses TopMemoryContext when
executed InHotStandby. Cleaner solution than using malloc or palloc
depending upon situation, as proposed by Tom.

14 years agoAugment WAL records for btree delete with GetOldestXmin() to reduce
Simon Riggs [Fri, 29 Jan 2010 18:39:05 +0000 (18:39 +0000)]
Augment WAL records for btree delete with GetOldestXmin() to reduce
false positives during Hot Standby conflict processing. Simple
patch to enhance conflict processing, following previous discussions.
Controlled by parameter minimize_standby_conflicts = on | off, with
default off allows measurement of performance impact to see whether
it should be set on all the time.

14 years agoAllow psql variables to be interpolated with literal or identifier escaping.
Robert Haas [Fri, 29 Jan 2010 17:44:12 +0000 (17:44 +0000)]
Allow psql variables to be interpolated with literal or identifier escaping.

Loosely based on a patch by Pavel Stehule.

14 years agoFilter recovery conflicts based upon dboid from relfilenode of WAL
Simon Riggs [Fri, 29 Jan 2010 17:10:05 +0000 (17:10 +0000)]
Filter recovery conflicts based upon dboid from relfilenode of WAL
records for heap and btree. Minor change, mostly API changes to
pass through the required values. This is a simple change though
also provides the refactoring required for further enhancements
to conflict processing using the relOid. Changes only have effect
during Hot Standby.

14 years agoChanged ECPG outofscope handling to always print out statements in the same order
Michael Meskes [Fri, 29 Jan 2010 16:28:13 +0000 (16:28 +0000)]
Changed ECPG outofscope handling to always print out statements in the same order
so regression testing is possible,

by Zoltan Boszormenyi

14 years agoFixed a few typos in ecpg. Two were in comments, the third made a log output reverse...
Michael Meskes [Fri, 29 Jan 2010 15:57:01 +0000 (15:57 +0000)]
Fixed a few typos in ecpg. Two were in comments, the third made a log output reverse yes and no.

14 years agoFix command tag for ALTER LARGE OBJECT.
Itagaki Takahiro [Fri, 29 Jan 2010 06:03:15 +0000 (06:03 +0000)]
Fix command tag for ALTER LARGE OBJECT.

14 years agoFix thinko in new installcheck-world target
Andrew Dunstan [Fri, 29 Jan 2010 01:06:18 +0000 (01:06 +0000)]
Fix thinko in new installcheck-world target

14 years agoAdd new make targets "world", "install-world" and "installcheck-world" to build,...
Andrew Dunstan [Thu, 28 Jan 2010 23:59:52 +0000 (23:59 +0000)]
Add new make targets "world", "install-world" and "installcheck-world" to build, install and check just about everything.
In addition to everything built installed and tested by all, install and installcheck targets, these build HTML Docs,
build and test contrib, and test PLs and ECPG.

14 years agoType table feature
Peter Eisentraut [Thu, 28 Jan 2010 23:21:13 +0000 (23:21 +0000)]
Type table feature

This adds the CREATE TABLE name OF type command, per SQL standard.

14 years agoFix bug found by warning from recent gcc. patch from Tim Bunce.
Andrew Dunstan [Thu, 28 Jan 2010 23:06:09 +0000 (23:06 +0000)]
Fix bug found by warning from recent gcc. patch from Tim Bunce.