PostgreSQL 9.0.4 commit log

Tag 9.0.4.

commit   : ffb39e1aedcdd7b77ec920221b27ab02c40ddbfc    
  
author   : Marc G. Fournier <[email protected]>    
date     : Fri, 15 Apr 2011 00:15:53 -0300    
  
committer: Marc G. Fournier <[email protected]>    
date     : Fri, 15 Apr 2011 00:15:53 -0300    

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

Translation updates

commit   : 65a188e549a8bf7d0e180d7bbbf6823e77c953bb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Apr 2011 22:52:18 +0300    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Apr 2011 22:52:18 +0300    

Click here for diff

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/fr.po

Update release notes for releases 9.0.4, 8.4.8, 8.3.15, and 8.2.21.

commit   : b37834ab69b25931325eb09afb053ce954edf150    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2011 15:51:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2011 15:51:41 -0400    

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

Ensure mark_dummy_rel doesn't create dangling pointers in RelOptInfos.

commit   : bcddad22aedb37126e47c946e00ee03811676c09    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2011 18:56:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2011 18:56:47 -0400    

Click here for diff

When we are doing GEQO join planning, the current memory context is a  
short-lived context that will be reset at the end of geqo_eval().  However,  
the RelOptInfos for base relations are set up before that and then re-used  
across many GEQO cycles.  Hence, any code that modifies a baserel during  
join planning has to be careful not to put pointers to the short-lived  
context into the baserel struct.  mark_dummy_rel got this wrong, leading to  
easy-to-reproduce-once-you-know-how crashes in 8.4, as reported off-list by  
Leo Carson of SDSC.  Some improvements made in 9.0 make it difficult to  
demonstrate the crash in 9.0 or HEAD; but there's no doubt that there's  
still a risk factor here, so patch all branches that have the function.  
(Note: 8.3 has a similar function, but it's only applied to joinrels and  
thus is not a hazard.)  

M src/backend/optimizer/path/joinrels.c

Update time zone data files to tzdata release 2011f.

commit   : 078a930bbdd605517d5894710f67e734bda2b02c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2011 18:03:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2011 18:03:23 -0400    

Click here for diff

DST law changes in Chile, Cuba, Falkland Islands, Morocco, Samoa, Turkey.  
Historical corrections for South Australia, Alaska, Hawaii.  

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

On HP/UX, the structs used by ioctl(SIOCGLIFCONF) are named differently than on other platforms, and only IPv6 addresses are returned. Because of those two issues, fall back to ioctl(SIOCGIFCONF) on HP/UX, so that it at least compiles and finds IPv4 addresses. This function is currently only used for interpreting samehost/samenet in pg_hba.conf, which isn't that critical.

commit   : 66bd917b591371811fe08c5071757b2ab654a6ff    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 13 Apr 2011 22:20:31 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 13 Apr 2011 22:20:31 +0300    

Click here for diff

M src/backend/libpq/ip.c

Revert the patch to check if we've reached end-of-backup also when doing crash recovery, and throw an error if not. hubert depesz lubaczewski pointed out that that situation also happens in the crash recovery following a system crash that happens during an online backup.

commit   : 083cc494228c55f38d2fcc9ec19c957eff7adb00    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 13 Apr 2011 21:33:59 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 13 Apr 2011 21:33:59 +0300    

Click here for diff

We might want to do something smarter in 9.1, like put the check back for  
backups taken with pg_basebackup, but that's for another patch.  

M src/backend/access/transam/xlog.c

Fix pg_upgrade crash

commit   : 052e621cc2c25166037fe9fadd3082ae70045fec    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 13 Apr 2011 11:33:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 13 Apr 2011 11:33:55 -0400    

Click here for diff

Fix pg_upgrade crash in 9.0 caused by a new cluster database that  
doesn't exist in the old cluster;  instead throw an error.  This was  
reported to me by EnterpriseDB testing staff.  This bug does not exist  
in git head.  

M contrib/pg_upgrade/relfilenode.c

On IA64 architecture, we check the depth of the register stack in addition to the regular stack. The code to do that is platform and compiler specific, add support for the HP-UX native compiler.

commit   : e910bd2dfee154c2b010befac4f9b28bbc46003a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 13 Apr 2011 11:43:22 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 13 Apr 2011 11:43:22 +0300    

Click here for diff

M src/backend/tcop/postgres.c

Don't make "replication" magical as a user name, only as a database name, in pg_hba.conf.

commit   : 290bb9b61c64afdb7b733837c0a00427b58745aa    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 10 Apr 2011 14:51:26 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 10 Apr 2011 14:51:26 -0400    

Click here for diff

Per gripe from Josh Berkus. Backported from commit ed557a373c406bbb2a1843544ebbd856ca4cac47.  

M src/backend/libpq/hba.c

Be more wary of missing statistics in eqjoinsel_semi().

commit   : 159c47dc7170110a39f8a16b1d0b7811f5556f87    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2011 01:59:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2011 01:59:42 -0400    

Click here for diff

In particular, if we don't have real ndistinct estimates for both sides,  
fall back to assuming that half of the left-hand rows have join partners.  
This is what was done in 8.2 and 8.3 (cf nulltestsel() in those versions).  
It's pretty stupid but it won't lead us to think that an antijoin produces  
no rows out, as seen in recent example from Uwe Schroeder.  

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

Adjust regression tests on cube and ECPG for MinGW 64 bit compiler.

commit   : 0e754ab366e9a200ef7342dc6ada42ae014a6739    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 10 Apr 2011 17:03:44 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 10 Apr 2011 17:03:44 -0400    

Click here for diff

Backport to 9.0, we're not supporting this compiler on earlier releases.  

A contrib/cube/expected/cube_3.out
M src/interfaces/ecpg/test/resultmap

Backport changes to allow building with MinGW 64 bit compiler.

commit   : 2ea865de5660f75f44f6b1ba78090e41e070cb4c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 9 Apr 2011 17:59:27 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 9 Apr 2011 17:59:27 -0400    

Click here for diff

These changes have been in HEAD for some time with no ill effect. They  
are only being backported to 9.0, as the required WINNT version was not  
high enough before that.  

M config/ac_func_accept_argtypes.m4
M configure
M src/include/c.h
M src/include/port.h
M src/include/port/win32.h
M src/include/port/win32/sys/socket.h
M src/port/getaddrinfo.c
M src/test/regress/resultmap

Have pg_upgrade properly preserve relfrozenxid in toast tables.

commit   : 00bf707113a297aa85c38beda8fb1247fe4bd304    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 8 Apr 2011 11:59:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 8 Apr 2011 11:59:14 -0400    

Click here for diff

This fixes a pg_upgrade bug that could lead to query errors when clog  
files are improperly removed.  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Avoid use of mixed slash style paths in arguments to xcopy in MSVC builds.

commit   : a5c629f373a8125cd7682083a290fff452db3757    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 7 Apr 2011 22:16:56 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 7 Apr 2011 22:16:56 -0400    

Click here for diff

Some versions of xcopy, notably on Windows 7 don't like it. Backpatch  
to 8.3, where we first used xcopy.  

M src/tools/msvc/Install.pm

Modernize dlopen interface code for FreeBSD and OpenBSD.

commit   : bb3051e4c2d7b42516d55925edefb4934b902374    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2011 15:14:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2011 15:14:44 -0400    

Click here for diff

Remove the hard-wired assumption that __mips__ (and only __mips__) lacks  
dlopen in FreeBSD and OpenBSD.  This assumption is outdated at least for  
OpenBSD, as per report from an anonymous 9.1 tester.  We can perfectly well  
use HAVE_DLOPEN instead to decide which code to use.  
  
Some other cosmetic adjustments to make freebsd.c, netbsd.c, and openbsd.c  
exactly alike.  

M src/backend/port/dynloader/freebsd.c
M src/backend/port/dynloader/netbsd.c
M src/backend/port/dynloader/openbsd.c

Fix SortTocFromFile() to cope with lines that are too long for its buffer.

commit   : e2c946018fe27e5b21d8e2cd00d05f33b19709a4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2011 11:40:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2011 11:40:28 -0400    

Click here for diff

The original coding supposed that a dump TOC file could never contain lines  
longer than 1K.  The folly of that was exposed by a recent report from  
Per-Olov Esgard.  We only really need to see the first dozen or two bytes  
of each line, since we're just trying to read off the numeric ID at the  
start of the line; so there's no need for a particularly huge buffer.  
What there is a need for is logic to not process continuation bufferloads.  
  
Back-patch to all supported branches, since it's always been like this.  

M src/bin/pg_dump/pg_backup_archiver.c

Fix typo in PQconnectStartParams().

commit   : 672def62259354f28000e8cfb97b6668192369c2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2011 18:05:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2011 18:05:46 -0400    

Click here for diff

This would lead to leaking the PGconn structure after an error detected by  
conninfo_array_parse(), as well as failing to return a useful error message  
in such cases.  Backpatch to 9.0 where the error was introduced.  
  
Joseph Adams  

M src/interfaces/libpq/fe-connect.c

Avoid palloc before CurrentMemoryContext is set up on win32

commit   : 7b99cfbe565e1b2193cefff79f2476c8373b7c61    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 1 Apr 2011 19:58:36 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 1 Apr 2011 19:58:36 +0200    

Click here for diff

Instead, write the unconverted output - it will be in the wrong  
encoding, but at least we don't crash.  
  
Rushabh Lathia  

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

Check that we've reached end-of-backup also when we're not performing archive recovery.

commit   : eff933531e7f7d98ba02402c7821b0b7ea8f1d97    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Mar 2011 10:36:58 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 30 Mar 2011 10:36:58 +0300    

Click here for diff

It's possible to restore an online backup without recovery.conf, by simply  
copying all the necessary WAL files to pg_xlog. "pg_basebackup -x" does that  
too. That's the use case where this cross-check is useful.  
  
Backpatch to 9.0. We used to do this in earlier versins, but in 9.0 the code  
was inadvertently changed so that the check is only performed after archive  
recovery.  
  
Fujii Masao.  

M src/backend/access/transam/xlog.c

Prevent a rowtype from being included in itself.

commit   : ce3b0ab0c327b2e3efa44342ad8de3256806cf84    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2011 15:45:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2011 15:45:02 -0400    

Click here for diff

Eventually we might be able to allow that, but it's not clear how many  
places need to be fixed to prevent infinite recursion when there's a direct  
or indirect inclusion of a rowtype in itself.  One such place is  
CheckAttributeType(), which will recurse to stack overflow in cases such as  
those exhibited in bug #5950 from Alex Perepelica.  If we were sure it was  
the only such place, we could easily modify the code added by this patch to  
stop the recursion without a complaint ... but it probably isn't the only  
such place.  Hence, throw error until such time as someone is excited  
enough about this type of usage to put work into making it safe.  
  
Back-patch as far as 8.3.  8.2 doesn't have the recursive call in  
CheckAttributeType in the first place, so I see no need to add code there  
in the absence of clear evidence of a problem elsewhere.  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/tablecmds.c
M src/include/catalog/heap.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Correct "characters" to "bytes" in createdb docs.

commit   : 3a88af0425fc5954dd8e8396d17ec0dbc2d55f5a    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 27 Mar 2011 21:28:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 27 Mar 2011 21:28:15 -0400    

Click here for diff

Susanne Ebrecht  

M doc/src/sgml/start.sgml

Improve user-defined-aggregates documentation.

commit   : 03c77337209f0b2b3059d6ee9df2f94c6f66d910    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2011 16:57:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2011 16:57:29 -0400    

Click here for diff

On closer inspection, that two-element initcond value seems to have been  
a little white lie to avoid explaining the full behavior of float8_accum.  
But if people are going to expect the examples to be exactly correct,  
I suppose we'd better explain.  Per comment from Thom Brown.  

M doc/src/sgml/xaggr.sgml

Fix ancient typo in user-defined-aggregates documentation.

commit   : 6d0877fc5e5847e272129eb23ae48246ca352d2a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2011 12:33:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Mar 2011 12:33:14 -0400    

Click here for diff

The description of the initcond value for the built-in avg(float8)  
aggregate has been wrong since it was written.  Noted by Disc Magnet.  

M doc/src/sgml/xaggr.sgml

Prevent intermittent hang in recovery from bgwriter interaction. Startup process waited for cleanup lock but when hot_standby = off the pid was not registered, so that the bgwriter would not wake the waiting process as intended.

commit   : 9bb1ddec4cd998c5fbac278a54d8ad5a5011e4e1    
  
author   : Simon Riggs <[email protected]>    
date     : Wed, 23 Mar 2011 13:32:37 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Wed, 23 Mar 2011 13:32:37 +0000    

Click here for diff

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

Avoid potential deadlock in InitCatCachePhase2().

commit   : 3cb2f2ae4cc481dc22682d364e7a93ba6f7f4baf    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Mar 2011 13:01:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Mar 2011 13:01:04 -0400    

Click here for diff

Opening a catcache's index could require reading from that cache's own  
catalog, which of course would acquire AccessShareLock on the catalog.  
So the original coding here risks locking index before heap, which could  
deadlock against another backend trying to get exclusive locks in the  
normal order.  Because InitCatCachePhase2 is only called when a backend  
has to start up without a relcache init file, the deadlock was seldom seen  
in the field.  (And by the same token, there's no need to worry about any  
performance disadvantage; so not much point in trying to distinguish  
exactly which catalogs have the risk.)  
  
Bug report, diagnosis, and patch by Nikhil Sontakke.  Additional commentary  
by me.  Back-patch to all supported branches.  

M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/relcache.c

Fix PL/Python memory leak involving array slices

commit   : 38e5124574ae86bf8992c17c176958b0ec4d6ee0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Mar 2011 12:28:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Mar 2011 12:28:46 -0300    

Click here for diff

Report and patch from Daniel Popowich, bug #5842  
(with some debugging help from Alex Hunsaker)  

M src/pl/plpython/plpython.c

Use correct PATH separator for Cygwin in pg_regress.c.

commit   : 7ae983d94dfe6479980e24aa179d1561ad5a3655    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 17 Mar 2011 00:11:01 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 17 Mar 2011 00:11:01 -0400    

Click here for diff

This has been broken for years, and I'm not sure why it has not been  
noticed before, but now a very modern Cygwin breaks on it, and the fix  
is clearly correct. Backpatching to all live branches.  

M src/test/regress/pg_regress.c

On further reflection, we'd better do the same in int.c.

commit   : f6b2ab7d95d718f67c0cde8e7638053d40c221e6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2011 19:04:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2011 19:04:05 -0500    

Click here for diff

We previously heard of the same problem in int24div(), so there's not a  
good reason to suppose the problem is confined to cases involving int8.  

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

Put in some more safeguards against executing a division-by-zero.

commit   : 03aab8262ae7b32f8fc6cd8933dce9604d7fc07e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2011 18:18:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2011 18:18:59 -0500    

Click here for diff

Add dummy returns before every potential division-by-zero in int8.c,  
because apparently further "improvements" in gcc's optimizer have  
enabled it to break functions that weren't broken before.  
  
Aurelien Jarno, via Martin Pitt  

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

In ecpg preprocessor, don't try to look up constants in the test for variable hiding. A constant is not a variable. It worked in most cases by accident, because we add constants to the global list of variables (why?), but float constants like 1.23 were interpreted as struct field references, and not found.

commit   : 2f418e8a174136507fb1f80214415b144e24850c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 11 Mar 2011 15:44:40 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 11 Mar 2011 15:44:40 +0200    

Click here for diff

Backpatch to 9.0, where the test for variable hiding was added.  

M src/interfaces/ecpg/preproc/type.c

Don't throw a warning if vacuum sees PD_ALL_VISIBLE flag set on a page that contains newly-inserted tuples that according to our OldestXmin are not yet visible to everyone. The value returned by GetOldestXmin() is conservative, and it can move backwards on repeated calls, so if we see that contradiction between the PD_ALL_VISIBLE flag and status of tuples on the page, we have to assume it's because an earlier vacuum calculated a higher OldestXmin value, and all the tuples really are visible to everyone.

commit   : b42225c101e61afdc9b4f5873654bc1e0c9f9179    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 8 Mar 2011 20:13:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 8 Mar 2011 20:13:52 +0200    

Click here for diff

We have received several reports of this bug, with the "PD_ALL_VISIBLE flag  
was incorrectly set in relation ..." warning appearing in logs. We were  
finally able to hunt it down with David Gould's help to run extra diagnostics  
in an environment where this happened frequently.  
  
Also reword the warning, per Robert Haas' suggestion, to not imply that the  
PD_ALL_VISIBLE flag is necessarily at fault, as it might also be a symptom  
of corruption on a tuple header.  
  
Backpatch to 8.4, where the PD_ALL_VISIBLE flag was introduced.  

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

In initialize_SSL, don't fail unnecessarily when home dir is unavailable.

commit   : 2ff092bcd8e204fa1a8469c64d2cc297242f31f4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Mar 2011 11:38:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Mar 2011 11:38:45 -0500    

Click here for diff

Instead, just act as though the certificate file(s) are not present.  
There is only one case where this need be a hard failure condition: when  
sslmode is verify-ca or verify-full, not having a root cert file is an  
error.  Change the logic so that we complain only in that case, and  
otherwise fall through cleanly.  This is how it used to behave pre-9.0,  
but my patch 4ed4b6c54e5fab24ab2624d80e26f7546edc88ad of 2010-05-26 broke  
the case.  Per report from Christian Kastner.  

M src/interfaces/libpq/fe-secure.c

Correct mistaken claims about EXPLAIN ANALYZE's handling of triggers.

commit   : a48fb0b59811e8b41e727b54b39bef28d6f253ea    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2011 11:17:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2011 11:17:07 -0500    

Click here for diff

Time spent executing AFTER triggers is not included in the runtime of the  
associated ModifyTable node; in my patch of yesterday I confused queuing of  
these triggers with their actual execution.  Spotted by Marko Tiikkaja.  

M doc/src/sgml/perform.sgml

Update discussion of EXPLAIN to reflect existence of ModifyTable nodes.

commit   : 82a0e3522205266601966560b398b6ac42731567    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Mar 2011 11:36:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Mar 2011 11:36:09 -0500    

Click here for diff

Back-patch to 9.0, since this was changed then.  

M doc/src/sgml/perform.sgml

Fix dangling-pointer problem in before-row update trigger processing.

commit   : 15907c36236d638437a1ed3efc0794fda2c9ad22    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Feb 2011 21:18:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Feb 2011 21:18:13 -0500    

Click here for diff

ExecUpdate checked for whether ExecBRUpdateTriggers had returned a new  
tuple value by seeing if the returned tuple was pointer-equal to the old  
one.  But the "old one" was in estate->es_junkFilter's result slot, which  
would be scribbled on if we had done an EvalPlanQual update in response to  
a concurrent update of the target tuple; therefore we were comparing a  
dangling pointer to a live one.  Given the right set of circumstances we  
could get a false match, resulting in not forcing the tuple to be stored in  
the slot we thought it was stored in.  In the case reported by Maxim Boguk  
in bug #5798, this led to "cannot extract system attribute from virtual  
tuple" failures when trying to do "RETURNING ctid".  I believe there is a  
very-low-probability chance of more serious errors, such as generating  
incorrect index entries based on the original rather than the  
trigger-modified version of the row.  
  
In HEAD, change all of ExecBRInsertTriggers, ExecIRInsertTriggers,  
ExecBRUpdateTriggers, and ExecIRUpdateTriggers so that they continue to  
have similar APIs.  In the back branches I just changed  
ExecBRUpdateTriggers, since there is no bug in the ExecBRInsertTriggers  
case.  

M src/backend/commands/trigger.c
M src/backend/executor/nodeModifyTable.c
M src/include/commands/trigger.h

Fix parallel pg_restore to handle comments on POST_DATA items correctly.

commit   : b22e2d6b0254e480f7ffa83ba17cd7a9e4cace98    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Feb 2011 13:11:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Feb 2011 13:11:50 -0500    

Click here for diff

The previous coding would try to process all SECTION_NONE items in the  
initial sequential-restore pass, which failed if they were dependencies of  
not-yet-restored items.  Fix by postponing such items into the parallel  
processing pass once we have skipped any non-PRE_DATA item.  
  
Back-patch into 9.0; the original parallel-restore coding in 8.4 did not  
have this bug, so no need to change it.  
  
Report and diagnosis by Arnd Hannemann.  

M src/bin/pg_dump/pg_backup_archiver.c

Fix tsmatchsel() to account properly for null rows.

commit   : 848cd3289e4d08f9a3c78f654ceb6e3f754e1dd3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Feb 2011 19:00:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Feb 2011 19:00:54 -0500    

Click here for diff

ts_typanalyze.c computes MCE statistics as fractions of the non-null rows,  
which seems fairly reasonable, and anyway changing it in released versions  
wouldn't be a good idea.  But then ts_selfuncs.c has to account for that.  
Failure to do so results in overestimates in columns with a significant  
fraction of null documents.  Back-patch to 8.4 where this stuff was  
introduced.  
  
Jesper Krogh  

M src/backend/tsearch/ts_selfuncs.c
M src/include/catalog/pg_statistic.h

Fix bogus test for hypothetical indexes in get_actual_variable_range().

commit   : 7422e0081d04ee4373a822392c729eb892a9d25e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Feb 2011 19:24:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Feb 2011 19:24:50 -0500    

Click here for diff

That function was supposing that indexoid == 0 for a hypothetical index,  
but that is not likely to be true in any non-toy implementation of an index  
adviser, since assigning a fake OID is the only way to know at EXPLAIN time  
which hypothetical index got selected.  Fix by adding a flag to  
IndexOptInfo to mark hypothetical indexes.  Back-patch to 9.0 where  
get_actual_variable_range() was added.  
  
Gurjeet Singh  

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

Add CheckTableNotInUse calls in DROP TABLE and DROP INDEX.

commit   : 8e4b1473126cc72fa9bcc5b079055c71bc267656    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Feb 2011 15:49:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Feb 2011 15:49:59 -0500    

Click here for diff

Recent releases had a check on rel->rd_refcnt in heap_drop_with_catalog,  
but failed to cover the possibility of pending trigger events at DROP time.  
(Before 8.4 we didn't even check the refcnt.)  When the trigger events were  
eventually fired, you'd get "could not open relation with OID nnn" errors,  
as in recent report from strk.  Better to throw a suitable error when the  
DROP is attempted.  
  
Also add a similar check in DROP INDEX.  
  
Back-patch to all supported branches.  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/interfaces/ecpg/test/expected/sql-fetch.stderr

Clarify documentation for libpq's PQescapeBytea to mention the new hex format.

commit   : 888fda809239f2b4c7daa992f504c495f7ec7c92    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 13 Feb 2011 09:29:01 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 13 Feb 2011 09:29:01 -0500    

Click here for diff

Modify PQescapeStringConn() docs to be consisent with other escaping  
functions.  
  
Add mention problems with pre-9.0 versions of libpq using not understanding  
bytea hex format to the 9.0 release notes.  
  
Backpatch to 9.0 docs.  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/release-9.0.sgml

Fix improper matching of resjunk column names for FOR UPDATE in subselect.

commit   : d5478c3391f8f1a243abbc3d9253aac3d6d3538e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Feb 2011 23:27:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Feb 2011 23:27:16 -0500    

Click here for diff

Flattening of subquery range tables during setrefs.c could lead to the  
rangetable indexes in PlanRowMark nodes not matching up with the column  
names previously assigned to the corresponding resjunk ctid (resp. tableoid  
or wholerow) columns.  Typical symptom would be either a "cannot extract  
system attribute from virtual tuple" error or an Assert failure.  This  
wasn't a problem before 9.0 because we didn't support FOR UPDATE below the  
top query level, and so the final flattening could never renumber an RTE  
that was relevant to FOR UPDATE.  Fix by using a plan-tree-wide unique  
number for each PlanRowMark to label the associated resjunk columns, so  
that the number need not change during flattening.  
  
Per report from David Johnston (though I'm darned if I can see how this got  
past initial testing of the relevant code).  Back-patch to 9.0.  

M src/backend/executor/execMain.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h

Fix typo.

commit   : 5dfc66b3d0b96f3a75adc4cd9c9f6d15c061cabd    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 3 Feb 2011 11:24:47 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 3 Feb 2011 11:24:47 +0100    

Click here for diff

Thom Brown  

M doc/src/sgml/ref/create_user_mapping.sgml

Undefine setlocale() macro on Win32

commit   : 1c4c264aa5c58777a18df5a268cc7702cdf5c940    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 1 Feb 2011 13:19:18 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 1 Feb 2011 13:19:18 +0100    

Click here for diff

New versions of libintl redefine setlocale() to a macro  
which causes problems when the backend and libintl are  
linked against different versions of the runtime, which  
is often the case in msvc builds.  
  
Hiroshi Inoue, slightly updated comment by me  

M src/include/port.h

Create new errcode for recovery conflict caused by db drop on master. Previously reported as ERRCODE_ADMIN_SHUTDOWN, this case is now reported as ERRCODE_DATABASE_DROPPED. No message text change. Unlikely to happen on most servers, so low impact change to allow session poolers to correctly handle this situation.

commit   : d6c1dc176a422ed19d698bb8ff9ed7b38c04a320    
  
author   : Simon Riggs <[email protected]>    
date     : Tue, 1 Feb 2011 08:49:58 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Tue, 1 Feb 2011 08:49:58 +0000    

Click here for diff

Tatsuo Ishii and Simon Riggs  

M doc/src/sgml/errcodes.sgml
M src/backend/tcop/postgres.c
M src/include/utils/errcodes.h
M src/pl/plpgsql/src/plerrcodes.h

Fix wrong error reports in 'number of array dimensions exceeds the maximum allowed' messages, that have reported one-less dimensions.

commit   : 9a012852897fec73ed1459486d6e8426c674d9ad    
  
author   : Itagaki Takahiro <[email protected]>    
date     : Tue, 1 Feb 2011 15:21:32 +0900    
  
committer: Itagaki Takahiro <[email protected]>    
date     : Tue, 1 Feb 2011 15:21:32 +0900    

Click here for diff

Alexey Klyukin  

M src/backend/executor/execQual.c
M src/backend/utils/adt/arrayfuncs.c
M src/pl/plpgsql/src/pl_exec.c

Fix error code for canceling statement due to conflict with recovery. All retryable conflict errors now have an error code that indicates that a retry is possible, correcting my incomplete fix of 2010/05/12

commit   : 6bfa6b0867c370d72cbaeba18d6d3a5d80eae0e7    
  
author   : Simon Riggs <[email protected]>    
date     : Mon, 31 Jan 2011 19:24:29 +0000    
  
committer: Simon Riggs <[email protected]>    
date     : Mon, 31 Jan 2011 19:24:29 +0000    

Click here for diff

Tatsuo Ishii and Simon Riggs, input from Robert Haas and Florian Pflug  

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

Make reduce_outer_joins() smarter about semijoins.

commit   : 1df57f63f3f60c684aa8918910ac410e9c780713    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Jan 2011 17:04:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Jan 2011 17:04:31 -0500    

Click here for diff

reduce_outer_joins() mistakenly treated a semijoin like a left join for  
purposes of deciding whether not-null constraints created by the join's  
quals could be passed down into the join's left-hand side (possibly  
resulting in outer-join simplification there).  Actually, semijoin works  
like inner join for this purpose, ie, we do not need to see any rows that  
can't possibly satisfy the quals.  Hence, two-line fix to treat semi and  
inner joins alike.  Per observation by Andres Freund about a performance  
gripe from Yazan Suleiman.  
  
Back-patch to 8.4, since this oversight has been there since the current  
handling of semijoins was implemented.  

M src/backend/optimizer/prep/prepjointree.c