PostgreSQL 9.0.6 commit log

Stamp 9.0.6.

commit   : 1c635b03c132a2ee07c1773c3968153f10ed5f79    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2011 16:49:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2011 16:49:59 -0500    

Click here for diff

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32
M src/interfaces/libpq/libpq.rc.in
M src/port/win32ver.rc

Clarify documentation about SQL:2008 variant of LIMIT/OFFSET syntax.

commit   : da1eacb8d2cebc5b43bbe2c93f1c74c962182ae5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2011 16:39:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2011 16:39:07 -0500    

Click here for diff

The point that you need parentheses for non-constant expressions apparently  
needs to be brought out a bit more clearly, per bug #6315.  

M doc/src/sgml/ref/select.sgml

Translation updates

commit   : 698bb4ec4f3f57df4d2c006a0f90552ab584b501    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Dec 2011 22:59:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Dec 2011 22:59:40 +0200    

Click here for diff

M src/backend/po/pl.po
M src/backend/po/pt_BR.po
M src/bin/initdb/po/pl.po
M src/bin/pg_config/po/pl.po
M src/bin/pg_controldata/po/pl.po
M src/bin/pg_ctl/po/pl.po
M src/bin/pg_dump/po/pl.po
M src/bin/pg_resetxlog/po/pl.po
M src/bin/psql/po/de.po
M src/bin/psql/po/pl.po
M src/bin/psql/po/pt_BR.po
M src/bin/scripts/po/pl.po
M src/interfaces/ecpg/ecpglib/po/pl.po
M src/interfaces/ecpg/preproc/po/pl.po
M src/interfaces/libpq/po/pl.po
M src/pl/plperl/po/pl.po
M src/pl/plpgsql/src/po/pl.po
M src/pl/plpython/po/pl.po
M src/pl/tcl/po/pl.po

Fix getTypeIOParam to support type record[].

commit   : efb74237937a95de3e933c807861bf70ae0149ce    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2011 12:44:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2011 12:44:28 -0500    

Click here for diff

Since record[] uses array_in, it needs to have its element type passed  
as typioparam.  In HEAD and 9.1, this fix essentially reverts commit  
9bc933b2125a5358722490acbc50889887bf7680, which was a hack that is no  
longer needed since domains don't set their typelem anymore.  Before  
that, adjust the logic so that only domains are excluded from being  
treated like arrays, rather than assuming that only base types should  
be included.  Add a regression test to demonstrate the need for this.  
Per report from Maxim Boguk.  
  
Back-patch to 8.4, where type record[] was added.  

M src/backend/utils/cache/lsyscache.c
M src/test/regress/expected/polymorphism.out
M src/test/regress/sql/polymorphism.sql

Update information about configuring SysV IPC parameters on NetBSD.

commit   : 83c461e8fa158130f885dc4570217f49cfd61f55    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2011 20:55:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2011 20:55:10 -0500    

Click here for diff

Per Emmanuel Kasper, sysctl works fine as of NetBSD 5.0.  

M doc/src/sgml/runtime.sgml

Draft release notes for 9.1.2, 9.0.6, 8.4.10, 8.3.17, 8.2.23.

commit   : 33dcc3e09a9f7f23b74b3b6b3feebd8bbda47d4e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2011 19:34:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2011 19:34:57 -0500    

Click here for diff

M doc/src/sgml/release-8.2.sgml
M doc/src/sgml/release-8.3.sgml
M doc/src/sgml/release-8.4.sgml
M doc/src/sgml/release-9.0.sgml

Update time zone data files to tzdata release 2011n.

commit   : 11fa0830d13e4e4698231472954f282d2cc2eae7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2011 11:48:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2011 11:48:05 -0500    

Click here for diff

DST law changes in Brazil, Cuba, Fiji, Palestine, Russia, Samoa.  
Historical corrections for Alaska and British East Africa.  

M src/timezone/data/africa
M src/timezone/data/asia
M src/timezone/data/australasia
M src/timezone/data/backward
M src/timezone/data/europe
M src/timezone/data/northamerica
M src/timezone/data/southamerica
M src/timezone/data/zone.tab

Tweak previous patch to ensure edata->filename always gets initialized.

commit   : b06c6f52d02f58a3144947a70a92c3ab25878ec0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2011 00:37:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2011 00:37:20 -0500    

Click here for diff

On a platform that isn't supplying __FILE__, previous coding would either  
crash or give a stale result for the filename string.  Not sure how likely  
that is, but the original code catered for it, so let's keep doing so.  

M src/backend/utils/error/elog.c

Strip file names reported in error messages in vpath builds

commit   : 75b61836940aaa81f3073c7e77f8c295d99093ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Nov 2011 22:04:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Nov 2011 22:04:59 +0200    

Click here for diff

In vpath builds, the __FILE__ macro that is used in verbose error  
reports contains the full absolute file name, which makes the error  
messages excessively verbose.  So keep only the base name, thus  
matching the behavior of non-vpath builds.  

M src/backend/utils/error/elog.c

Remove erroneous claim about use of pg_locks.objid for advisory locks.

commit   : d16ebde58275d848968e758ec643efc8ce64c8fa    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Nov 2011 13:52:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Nov 2011 13:52:09 -0500    

Click here for diff

The correct information appears in the text, so just remove the statement  
in the table, where it did not fit nicely anyway.  (Curiously, the correct  
info has been there much longer than the erroneous table entry.)  
Resolves problem noted by Daniele Varrazzo.  
  
In HEAD and 9.1, also do a bit of wordsmithing on other text on the page.  

M doc/src/sgml/catalogs.sgml

Backpatch "Use the preferred version of xsubpp."

commit   : 62fa8562ecf3dc42b04997598d6b04b9ced28ed1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 Nov 2011 07:54:03 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 Nov 2011 07:54:03 -0500    

Click here for diff

As requested this is backpatched all the way to release 8.2.  

M src/pl/plperl/GNUmakefile
M src/tools/msvc/Mkvcbuild.pm

Ensure that whole-row junk Vars are always of composite type.

commit   : b09fc7c39dd69c2eda17c7a3f532cf38ea22a9e9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Nov 2011 22:27:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Nov 2011 22:27:39 -0500    

Click here for diff

The EvalPlanQual machinery assumes that whole-row Vars generated for the  
outputs of non-table RTEs will be of composite types.  However, for the  
case where the RTE is a function call returning a scalar type, we were  
doing the wrong thing, as a result of sharing code with a parser case  
where the function's scalar output is wanted.  (Or at least, that's what  
that case has done historically; it does seem a bit inconsistent.)  
  
To fix, extend makeWholeRowVar's API so that it can support both use-cases.  
This fixes Belinda Cussen's report of crashes during concurrent execution  
of UPDATEs involving joins to the result of UNNEST() --- in READ COMMITTED  
mode, we'd run the EvalPlanQual machinery after a conflicting row update  
commits, and it was expecting to get a HeapTuple not a scalar datum from  
the "wholerowN" variable referencing the function RTE.  
  
Back-patch to 9.0 where the current EvalPlanQual implementation appeared.  
  
In 9.1 and up, this patch also fixes failure to attach the correct  
collation to the Var generated for a scalar-result case.  An example:  
regression=# select upper(x.*) from textcat('ab', 'cd') x;  
ERROR:  could not determine which collation to use for upper() function  

M src/backend/nodes/makefuncs.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/parser/parse_expr.c
M src/include/nodes/makefuncs.h

Fix overly-aggressive and inconsistent quoting in OS X start script.

commit   : 87b0dcf490ffe2930940488b89ff94c62dd7153b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Nov 2011 13:01:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Nov 2011 13:01:02 -0500    

Click here for diff

Sidar Lopez, per bug #6310, with some additional improvements by me.  
Back-patch to 9.0, where the issue was introduced.  

M contrib/start-scripts/osx/PostgreSQL

Allow pg_upgrade to upgrade clusters that use exclusion contraints by fixing pg_dump to properly preserve such indexes.

commit   : d1644d9c31102e12560c864fae10bb7ab1826adb    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 25 Nov 2011 14:34:51 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 25 Nov 2011 14:34:51 -0500    

Click here for diff

Backpatch to 9.1 and 9.0 (where the bug was introduced).  

M src/bin/pg_dump/pg_dump.c

Fix erroneous replay of GIN_UPDATE_META_PAGE WAL records.

commit   : 80cbf3401c6cab7e00628b9cf5ca204c0726b9cc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Nov 2011 13:58:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Nov 2011 13:58:59 -0500    

Click here for diff

A simple thinko in ginRedoUpdateMetapage, namely failing to increment a  
loop counter, led to inserting records into the last pending-list page in  
the wrong order (the opposite of that intended).  So far as I can tell,  
this would not upset the code that eventually flushes pending items into  
the main part of the GIN index.  But it did break the code that searched  
the pending list for matches, resulting in transient failure to find  
matching entries during index lookups, as illustrated in bug #6307 from  
Maksym Boguk.  
  
Back-patch to 8.4 where the incorrect code was introduced.  

M src/backend/access/gin/ginxlog.c

Avoid floating-point underflow while tracking buffer allocation rate.

commit   : 3c4f293dd5b2ce32e6541a42a40cd0e3ae7b6874    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2011 00:35:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2011 00:35:29 -0500    

Click here for diff

When the system is idle for awhile after activity, the "smoothed_alloc"  
state variable in BgBufferSync converges slowly to zero.  With standard  
IEEE float arithmetic this results in several iterations with denormalized  
values, which causes kernel traps and annoying log messages on some  
poorly-designed platforms.  There's no real need to track such small values  
of smoothed_alloc, so we can prevent the kernel traps by forcing it to zero  
as soon as it's too small to be interesting for our purposes.  This issue  
is purely cosmetic, since the iterations don't happen fast enough for the  
kernel traps to pose any meaningful performance problem, but still it seems  
worth shutting up the log messages.  
  
The kernel log messages were previously reported by a number of people,  
but kudos to Greg Matthews for tracking down exactly where they were coming  
from.  

M src/backend/storage/buffer/bufmgr.c

Applied Zoltan's patch to correctly align interval and timestamp data in ecpg's sqlda.

commit   : acbddf45a48af1267b26a7e452f694ea656c838d    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 17 Nov 2011 14:07:25 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 17 Nov 2011 14:07:25 +0100    

Click here for diff

M src/interfaces/ecpg/ecpglib/sqlda.c

Don't elide blank lines when accumulating psql command history.

commit   : 90bbeb195deed468decbd03af713512a990c1938    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2011 20:34:47 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Nov 2011 20:34:47 -0500    

Click here for diff

This can change the meaning of queries, if the blank line happens to  
occur in the middle of a quoted literal, as per complaint from Tomas Vondra.  
  
Back-patch to all supported branches.  

M src/bin/psql/input.c

Applied patch by Zoltan to fix copy&paste bug in ecpg's sqlda handling.

commit   : f72baf7e61127eba512e5d0523a4c36ffa704913    
  
author   : Michael Meskes <[email protected]>    
date     : Sun, 13 Nov 2011 13:46:45 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Sun, 13 Nov 2011 13:46:45 +0100    

Click here for diff

M src/interfaces/ecpg/ecpglib/sqlda.c

Throw nice error if server is too old to support psql's \ef or \sf command.

commit   : c49130ade4dac5d8dff724cf15b0f0cdb9cf7d24    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2011 18:37:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2011 18:37:00 -0500    

Click here for diff

Previously, you'd get "function pg_catalog.pg_get_functiondef(integer) does  
not exist", which is at best rather unprofessional-looking.  Back-patch  
to 8.4 where \ef was introduced.  
  
Josh Kupershmidt  

M src/bin/psql/command.c

Correct documentation for trace_userlocks.

commit   : 019d45e13910a03fbd2f71293175b4ce09dcf0a7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 10 Nov 2011 18:00:34 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 10 Nov 2011 18:00:34 -0500    

Click here for diff

M doc/src/sgml/config.sgml

Fix server header file installation with vpath builds

commit   : 1d9d7a91bf2cdd226530c7c6b37b63473b298f07    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Nov 2011 20:52:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Nov 2011 20:52:54 +0200    

Click here for diff

Several server header files would not be installed in vpath builds  
because they live in the build directory.  

M src/include/Makefile

Make DatumGetInetP() unpack inet datums with a 1-byte header, and add a new macro, DatumGetInetPP(), that does not. This brings these macros in line with other DatumGet*P() macros.

commit   : a062ee4257c132b9119151b587b26b3a53558c76    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 8 Nov 2011 22:39:43 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 8 Nov 2011 22:39:43 +0200    

Click here for diff

Backpatch to 8.3, where 1-byte header varlenas were introduced.  

M src/backend/utils/adt/network.c
M src/include/utils/inet.h

-DLINUX_OOM_ADJ=0 should be in CPPFLAGS, not CFLAGS

commit   : 0ff319d20af757946f57719959172612d0ec75cc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Nov 2011 06:49:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Nov 2011 06:49:50 +0200    

Click here for diff

M doc/src/sgml/runtime.sgml

Fix assorted bugs in contrib/unaccent's configuration file parsing.

commit   : d747a45b46139eb78c060e1f3c3ee4d3dc72db12    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2011 11:48:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2011 11:48:53 -0500    

Click here for diff

Make it use t_isspace() to identify whitespace, rather than relying on  
sscanf which is known to get it wrong on some platform/locale combinations.  
Get rid of fixed-size buffers.  Make it actually continue to parse the file  
after ignoring a line with untranslatable characters, as was obviously  
intended.  
  
The first of these issues is per gripe from J Smith, though not exactly  
either of his proposed patches.  

M contrib/unaccent/unaccent.c

Don't assume that a tuple's header size is unchanged during toasting.

commit   : b07b2bdc570cfbb39564c8a70783dbce1edcb3d6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2011 23:23:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2011 23:23:16 -0400    

Click here for diff

This assumption can be wrong when the toaster is passed a raw on-disk  
tuple, because the tuple might pre-date an ALTER TABLE ADD COLUMN operation  
that added columns without rewriting the table.  In such a case the tuple's  
natts value is smaller than what we expect from the tuple descriptor, and  
so its t_hoff value could be smaller too.  In fact, the tuple might not  
have a null bitmap at all, and yet our current opinion of it is that it  
contains some trailing nulls.  
  
In such a situation, toast_insert_or_update did the wrong thing, because  
to save a few lines of code it would use the old t_hoff value as the offset  
where heap_fill_tuple should start filling data.  This did not leave enough  
room for the new nulls bitmap, with the result that the first few bytes of  
data could be overwritten with null flag bits, as in a recent report from  
Hubert Depesz Lubaczewski.  
  
The particular case reported requires ALTER TABLE ADD COLUMN followed by  
CREATE TABLE AS SELECT * FROM ... or INSERT ... SELECT * FROM ..., and  
further requires that there be some out-of-line toasted fields in one of  
the tuples to be copied; else we'll not reach the troublesome code.  
The problem can only manifest in this form in 8.4 and later, because  
before commit a77eaa6a95009a3441e0d475d1980259d45da072, CREATE TABLE AS or  
INSERT/SELECT wouldn't result in raw disk tuples getting passed directly  
to heap_insert --- there would always have been at least a junkfilter in  
between, and that would reconstitute the tuple header with an up-to-date  
t_natts and hence t_hoff.  But I'm backpatching the tuptoaster change all  
the way anyway, because I'm not convinced there are no older code paths  
that present a similar risk.  

M src/backend/access/heap/tuptoaster.c

Fix archive_command example

commit   : d8bff79f1e88f0fb9c66c45c359cc1c085dba429    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Nov 2011 22:01:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Nov 2011 22:01:35 +0200    

Click here for diff

The given archive_command example didn't use %p or %f, which wouldn't  
really work in practice.  

M doc/src/sgml/backup.sgml

Fix bogus code in contrib/ tsearch dictionary examples.

commit   : 3fbfd40b37eaf2db8698df1b5e41bc0fd6c80b51    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2011 19:17:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2011 19:17:59 -0400    

Click here for diff

Both dict_int and dict_xsyn were blithely assuming that whatever memory  
palloc gives back will be pre-zeroed.  This would typically work for  
just about long enough to run their regression tests, and no longer :-(.  
  
The pre-9.0 code in dict_xsyn was even lamer than that, as it would  
happily give back a pointer to the result of palloc(0), encouraging  
its caller to access off the end of memory.  Again, this would just  
barely fail to fail as long as memory contained nothing but zeroes.  
  
Per a report from Rodrigo Hjort that code based on these examples  
didn't work reliably.  

M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c

Fix inline_set_returning_function() to allow multiple OUT parameters.

commit   : 9b3c35a9db418379fc760105df04ac30810f9c88    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2011 17:53:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2011 17:53:26 -0400    

Click here for diff

inline_set_returning_function failed to distinguish functions returning  
generic RECORD (which require a column list in the RTE, as well as run-time  
type checking) from those with multiple OUT parameters (which do not).  
This prevented inlining from happening.  Per complaint from Jay Levitt.  
Back-patch to 8.4 where this capability was introduced.  

M src/backend/optimizer/util/clauses.c

Revert "Stop btree indexscans upon reaching nulls in either direction."

commit   : 42f77244e75a7f82bd87ccf72bdd9d2eb2005f69    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2011 13:36:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2011 13:36:31 -0400    

Click here for diff

This reverts commit 7357f92a3ef1faff0ce85f55f3c5a7f4dc820eaa.  
As pointed out by Naoya Anzai, we need to do more work to make that  
idea handle end-of-index cases, and it is looking like too much risk  
for a back-patch.  So bug #6278 is only going to be fixed in HEAD.  

M src/backend/access/nbtree/nbtutils.c

Derive oldestActiveXid at correct time for Hot Standby. There was a timing window between when oldestActiveXid was derived and when it should have been derived that only shows itself under heavy load. Move code around to ensure correct timing of derivation. No change to StartupSUBTRANS() code, which is where this failed.

commit   : 656bba95af3950b26e9e97d86d29787d89e2b423    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 2 Nov 2011 08:52:59 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 2 Nov 2011 08:52:59 +0000    

Click here for diff

Bug report by Chris Redekop  

M src/backend/access/transam/xlog.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/include/storage/procarray.h
M src/include/storage/standby.h

Start Hot Standby faster when initial snapshot is incomplete. If the initial snapshot had overflowed then we can start whenever the latest snapshot is empty, not overflowed or as we did already, start when the xmin on primary was higher than xmax of our starting snapshot, which proves we have full snapshot data.

commit   : ff8451aa14c8513e429cbef09ddc72e79da366a5    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 2 Nov 2011 08:27:00 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 2 Nov 2011 08:27:00 +0000    

Click here for diff

Bug report by Chris Redekop  

M src/backend/storage/ipc/procarray.c

Fix timing of Startup CLOG and MultiXact during Hot Standby

commit   : 2f55c535e1f026929cf20855b3790d3632062d42    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 2 Nov 2011 08:03:21 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 2 Nov 2011 08:03:21 +0000    

Click here for diff

Patch by me, bug report by Chris Redekop, analysis by Florian Pflug  

M src/backend/access/transam/clog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlog.c
M src/include/access/clog.h

Fix race condition with toast table access from a stale syscache entry.

commit   : 7f797d27fe0be5200ad5fd5af6cefcee30c8e24a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Nov 2011 19:48:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Nov 2011 19:48:49 -0400    

Click here for diff

If a tuple in a syscache contains an out-of-line toasted field, and we  
try to fetch that field shortly after some other transaction has committed  
an update or deletion of the tuple, there is a race condition: vacuum  
could come along and remove the toast tuples before we can fetch them.  
This leads to transient failures like "missing chunk number 0 for toast  
value NNNNN in pg_toast_2619", as seen in recent reports from Andrew  
Hammond and Tim Uckun.  
  
The design idea of syscache is that access to stale syscache entries  
should be prevented by relation-level locks, but that fails for at least  
two cases where toasted fields are possible: ANALYZE updates pg_statistic  
rows without locking out sessions that might want to plan queries on the  
same table, and CREATE OR REPLACE FUNCTION updates pg_proc rows without  
any meaningful lock at all.  
  
The least risky fix seems to be an idea that Heikki suggested when we  
were dealing with a related problem back in August: forcibly detoast any  
out-of-line fields before putting a tuple into syscache in the first place.  
This avoids the problem because at the time we fetch the parent tuple from  
the catalog, we should be holding an MVCC snapshot that will prevent  
removal of the toast tuples, even if the parent tuple is outdated  
immediately after we fetch it.  (Note: I'm not convinced that this  
statement holds true at every instant where we could be fetching a syscache  
entry at all, but it does appear to hold true at the times where we could  
fetch an entry that could have a toasted field.  We will need to be a bit  
wary of adding toast tables to low-level catalogs that don't have them  
already.)  An additional benefit is that subsequent uses of the syscache  
entry should be faster, since they won't have to detoast the field.  
  
Back-patch to all supported versions.  The problem is significantly harder  
to reproduce in pre-9.0 releases, because of their willingness to flush  
every entry in a syscache whenever the underlying catalog is vacuumed  
(cf CatalogCacheFlushRelation); but there is still a window for trouble.  

M src/backend/access/heap/tuptoaster.c
M src/backend/utils/cache/catcache.c
M src/include/access/tuptoaster.h

Document that multiple LDAP servers can be specified

commit   : be5531c58d323b1c154d3c18233aca2c25a1ad89    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 1 Nov 2011 15:44:26 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 1 Nov 2011 15:44:26 +0100    

Click here for diff

M doc/src/sgml/client-auth.sgml

Stop btree indexscans upon reaching nulls in either direction.

commit   : 7357f92a3ef1faff0ce85f55f3c5a7f4dc820eaa    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Oct 2011 16:40:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Oct 2011 16:40:16 -0400    

Click here for diff

The existing scan-direction-sensitive tests were overly complex, and  
failed to stop the scan in cases where it's perfectly legitimate to do so.  
Per bug #6278 from Maksym Boguk.  
  
Back-patch to 8.3, which is as far back as the patch applies easily.  
Doesn't seem worth sweating over a relatively minor performance issue in  
8.2 at this late date.  (But note that this was a performance regression  
from 8.1 and before, so 8.2 is being left as an outlier.)  

M src/backend/access/nbtree/nbtutils.c

Fix assorted bogosities in cash_in() and cash_out().

commit   : 50939443118613d3ae072d900c1e97f64722e07c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Oct 2011 14:31:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Oct 2011 14:31:03 -0400    

Click here for diff

cash_out failed to handle multiple-byte thousands separators, as per bug  
#6277 from Alexander Law.  In addition, cash_in didn't handle that either,  
nor could it handle multiple-byte positive_sign.  Both routines failed to  
support multiple-byte mon_decimal_point, which I did not think was worth  
changing, but at least now they check for the possibility and fall back to  
using '.' rather than emitting invalid output.  Also, make cash_in handle  
trailing negative signs, which formerly it would reject.  Since cash_out  
generates trailing negative signs whenever the locale tells it to, this  
last omission represents a fail-to-reload-dumped-data bug.  IMO that  
justifies patching this all the way back.  

M src/backend/utils/adt/cash.c

Update docs to point to the timezone library's new home at IANA.

commit   : 0418bea295d3809f8452d7cccedd6a6186749fd3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Oct 2011 23:09:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Oct 2011 23:09:15 -0400    

Click here for diff

The recent unpleasantness with copyrights has accelerated a move that  
was already in planning.  

M src/timezone/README

Change FK trigger creation order to better support self-referential FKs.

commit   : 68b09970177a848eedffebada0e59199c309693a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2011 13:02:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Oct 2011 13:02:40 -0400    

Click here for diff

When a foreign-key constraint references another column of the same table,  
row updates will queue both the PK's ON UPDATE action and the FK's CHECK  
action in the same event.  The ON UPDATE action must execute first, else  
the CHECK will check a non-final state of the row and possibly throw an  
inappropriate error, as seen in bug #6268 from Roman Lytovchenko.  
  
Now, the firing order of multiple triggers for the same event is determined  
by the sort order of their pg_trigger.tgnames, and the auto-generated names  
we use for FK triggers are "RI_ConstraintTrigger_NNNN" where NNNN is the  
trigger OID.  So most of the time the firing order is the same as creation  
order, and so rearranging the creation order fixes it.  
  
This patch will fail to fix the problem if the OID counter wraps around or  
adds a decimal digit (eg, from 99999 to 100000) while we are creating the  
triggers for an FK constraint.  Given the small odds of that, and the low  
usage of self-referential FKs, we'll live with that solution in the back  
branches.  A better fix is to change the auto-generated names for FK  
triggers, but it seems unwise to do that in stable branches because there  
may be client code that depends on the naming convention.  We'll fix it  
that way in HEAD in a separate patch.  
  
Back-patch to all supported branches, since this bug has existed for a long  
time.  

M src/backend/commands/tablecmds.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Don't trust deferred-unique indexes for join removal.

commit   : 9fbb3edff085f2f004c24b988b43c7cd4f132e2f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2011 00:43:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Oct 2011 00:43:52 -0400    

Click here for diff

The uniqueness condition might fail to hold intra-transaction, and assuming  
it does can give incorrect query results.  Per report from Marti Raudsepp,  
though this is not his proposed patch.  
  
Back-patch to 9.0, where both these features were introduced.  In the  
released branches, add the new IndexOptInfo field to the end of the struct,  
to try to minimize ABI breakage for third-party code that may be examining  
that struct.  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/relation.h

Fix pg_dump to dump casts between auto-generated types.

commit   : 015cda44cfc5e02ec7147ab55560bd14c74acf08    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Oct 2011 17:11:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Oct 2011 17:11:07 -0400    

Click here for diff

The heuristic for when to dump a cast failed for a cast between table  
rowtypes, as reported by Frédéric Rejol.  Fix it by setting  
the "dump" flag for such a type the same way as the flag is set for the  
underlying table or base type.  This won't result in the auto-generated  
type appearing in the output, since setting its objType to DO_DUMMY_TYPE  
unconditionally suppresses that.  But it will result in dumpCast doing what  
was intended.  
  
Back-patch to 8.3.  The 8.2 code is rather different in this area, and it  
doesn't seem worth any risk to fix a corner case that nobody has stumbled  
on before.  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c

Fix bugs in information_schema.referential_constraints view.

commit   : 9ca46f5bb67de41f524315e414ea57fdbd614111    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2011 20:24:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2011 20:24:32 -0400    

Click here for diff

This view was being insufficiently careful about matching the FK constraint  
to the depended-on primary or unique key constraint.  That could result in  
failure to show an FK constraint at all, or showing it multiple times, or  
claiming that it depended on a different constraint than the one it really  
does.  Fix by joining via pg_depend to ensure that we find only the correct  
dependency.  
  
Back-patch, but don't bump catversion because we can't force initdb in back  
branches.  The next minor-version release notes should explain that if you  
need to fix this in an existing installation, you can drop the  
information_schema schema then re-create it by sourcing  
$SHAREDIR/information_schema.sql in each database (as a superuser of  
course).  

M src/backend/catalog/information_schema.sql

Modify up/home macro to match standard parameter list; fixes doc build.

commit   : 7ddd5bd7cee577c142f5145764e0dbe3fccdeb04    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 12 Oct 2011 14:03:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 12 Oct 2011 14:03:18 -0400    

Click here for diff

M doc/src/sgml/stylesheet.dsl

Improve documentation of psql's \q command.

commit   : 606990dcf898243f635b421d5d99439cbbf8ddc2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2011 13:59:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2011 13:59:30 -0400    

Click here for diff

The documentation neglected to explain its behavior in a script file  
(it only ends execution of the script, not psql as a whole), and failed  
to mention the long form \quit either.  

M doc/src/sgml/ref/psql-ref.sgml

commit   : 55800b68de142a5f559ffcac8015f3ce047aee61    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 12 Oct 2011 11:48:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 12 Oct 2011 11:48:02 -0400    

Click here for diff

Backpatch to 9.0.X and 9.1.X.  

M doc/src/sgml/stylesheet.dsl

Fix typo in docs for libpq keepalives_count option.

commit   : 9c09e7cf2dd55a541e4c58d187754b5a8d8d353a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 10 Oct 2011 13:10:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 10 Oct 2011 13:10:47 -0400    

Click here for diff

Shigehiro Honda  

M doc/src/sgml/libpq.sgml

Don't let transform_null_equals=on affect CASE foo WHEN NULL ... constructs. transform_null_equals is only supposed to affect "foo = NULL" expressions given directly by the user, not the internal "foo = NULL" expression generated from CASE-WHEN.

commit   : c02e52dfdc18605f263aa67d3b2563551222f719    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 8 Oct 2011 11:17:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 8 Oct 2011 11:17:40 +0300    

Click here for diff

This fixes bug #6242, reported by Sergey. Backpatch to all supported  
branches.  

M src/backend/parser/parse_expr.c

Make pgstatindex respond to cancel interrupts.

commit   : b77b6015d84a30caa31977af3667a7e42f6e82a1    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 6 Oct 2011 12:08:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 6 Oct 2011 12:08:59 -0400    

Click here for diff

A similar problem for pgstattuple() was fixed in April of 2010 by commit  
33065ef8bc52253ae855bc959576e52d8a28ba06, but pgstatindex() seems to have  
been overlooked.  
  
Back-patch all the way, as with that commit, though not to 7.4 through  
8.1, since those are now EOL.  

M contrib/pgstattuple/pgstatindex.c

Add sourcefile/sourceline data to EXEC_BACKEND GUC transmission files.

commit   : ddc36df7af954f36648c675922b96e73897c7b27    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2011 17:00:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Oct 2011 17:00:17 -0400    

Click here for diff

This oversight meant that on Windows, the pg_settings view would not  
display source file or line number information for values coming from  
postgresql.conf, unless the backend had received a SIGHUP since starting.  
  
In passing, also make the error detection in read_nondefault_variables a  
tad more thorough, and fix it to not lose precision on float GUCs (these  
changes are already in HEAD as of my previous commit).  

M src/backend/utils/misc/guc.c

ProcedureCreate neglected to record dependencies on default expressions.

commit   : f994bf965d369124ab18d8504668db2787173fb9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2011 12:13:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2011 12:13:15 -0400    

Click here for diff

Thus, an object referenced in a default expression could be dropped while  
the function remained present.  This was unaccountably missed in the  
original patch to add default parameters for functions.  Reported by  
Pavel Stehule.  

M src/backend/catalog/pg_proc.c

Fix typo

commit   : b07de20ae6231e7e8b981de096d713a9c9e570e0    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 24 Sep 2011 14:34:32 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 24 Sep 2011 14:34:32 +0200    

Click here for diff

M doc/src/sgml/install-win32.sgml

Note that sslmode=require verifies the CA if root cert is present

commit   : 05c4ef629532ebe6a8f13e6c42cda8a3ea0bd34e    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 24 Sep 2011 14:29:37 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 24 Sep 2011 14:29:37 +0200    

Click here for diff

This mode still exists for backwards compatibility, making  
sslmode=require the same as sslmode=verify-ca when the file is present,  
but not causing an error when it isn't.  
  
Per bug 6189, reported by Srinivas Aji  

M doc/src/sgml/libpq.sgml

Fix our mapping of Windows timezones for Central America.

commit   : 23f7df5547d218b8e5f42b924c25625d1f1372a1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2011 22:12:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2011 22:12:36 -0400    

Click here for diff

We were mapping "Central America Standard Time" to "CST6CDT", which seems  
entirely wrong, because according to the Olson timezone database noplace  
in Central America observes daylight savings time on any regular basis ---  
and certainly not according to the USA DST rules that are implied by  
"CST6CDT".  (Mexico is an exception, but they can be disregarded since  
they have a separate timezone name in Windows.)  So, map this zone name to  
plain "CST6", which will provide a fixed UTC offset.  
  
As written, this patch will also result in mapping "Central America  
Daylight Time" to CST6.  I considered hacking things so that would still  
map to CST6CDT, but it seems it would confuse win32tzlist.pl to put those  
two names in separate entries.  Since there's little evidence that any  
such zone name is used in the wild, much less that CST6CDT would be a good  
match for it, I'm not too worried about what we do with it.  
  
Per complaint from Pratik Chirania.  

M src/timezone/pgtz.c