]> git.ipfire.org Git - thirdparty/postgresql.git/log
thirdparty/postgresql.git
15 years agoFix RelationCacheInitializePhase2 (Phase3, in HEAD) to cope with the
Tom Lane [Sat, 26 Sep 2009 18:25:27 +0000 (18:25 +0000)] 
Fix RelationCacheInitializePhase2 (Phase3, in HEAD) to cope with the
possibility of shared-inval messages causing a relcache flush while it tries
to fill in missing data in preloaded relcache entries.  There are actually
two distinct failure modes here:

1. The flush could delete the next-to-be-processed cache entry, causing
the subsequent hash_seq_search calls to go off into the weeds.  This is
the problem reported by Michael Brown, and I believe it also accounts
for bug #5074.  The simplest fix is to restart the hashtable scan after
we've read any new data from the catalogs.  It appears that pre-8.4
branches have not suffered from this failure, because by chance there were
no other catalogs sharing the same hash chains with the catalogs that
RelationCacheInitializePhase2 had work to do for.  However that's obviously
pretty fragile, and it seems possible that derivative versions with
additional system catalogs might be vulnerable, so I'm back-patching this
part of the fix anyway.

2. The flush could delete the *current* cache entry, in which case the
pointer to the newly-loaded data would end up being stored into an
already-deleted Relation struct.  As long as it was still deleted, the only
consequence would be some leaked space in CacheMemoryContext.  But it seems
possible that the Relation struct could already have been recycled, in
which case this represents a hard-to-reproduce clobber of cached data
structures, with unforeseeable consequences.  The fix here is to pin the
entry while we work on it.

In passing, also change RelationCacheInitializePhase2 to Assert that
formrdesc() set up the relation's cached TupleDesc (rd_att) with the
correct type OID and hasoids values.  This is more appropriate than
silently updating the values, because the original tupdesc might already
have been copied into the catcache.  However this part of the patch is
not in HEAD because it fails due to some questionable recent changes in
formrdesc :-(.  That will be cleaned up in a subsequent patch.

15 years agoRemove outside-the-scanner references to "yyleng".
Tom Lane [Tue, 8 Sep 2009 04:26:04 +0000 (04:26 +0000)] 
Remove outside-the-scanner references to "yyleng".

It seems the flex developers have decided to change yyleng from int to size_t.
This has already happened in the latest release of OS X, and will start
happening elsewhere once the next release of flex appears.  Rather than trying
to divine how it's declared in any particular build, let's just remove the one
existing not-very-necessary external usage.

Back-patch to all supported branches; not so much because users in the field
are likely to care about building old branches with cutting-edge flex, as
to keep OSX-based buildfarm members from having problems with old branches.

15 years agoTag 8.0.22 REL8_0_22
Marc G. Fournier [Fri, 4 Sep 2009 05:28:47 +0000 (05:28 +0000)] 
Tag 8.0.22

15 years agoFinal updates of release notes for 8.4.1, 8.3.8, 8.2.14, 8.1.18, 8.0.22,
Tom Lane [Thu, 3 Sep 2009 22:14:33 +0000 (22:14 +0000)] 
Final updates of release notes for 8.4.1, 8.3.8, 8.2.14, 8.1.18, 8.0.22,
7.4.26.

15 years agoDisallow RESET ROLE and RESET SESSION AUTHORIZATION inside security-definer
Tom Lane [Thu, 3 Sep 2009 22:08:54 +0000 (22:08 +0000)] 
Disallow RESET ROLE and RESET SESSION AUTHORIZATION inside security-definer
functions.

This extends the previous patch that forbade SETting these variables inside
security-definer functions.  RESET is equally a security hole, since it
would allow regaining privileges of the caller; furthermore it can trigger
Assert failures and perhaps other internal errors, since the code is not
expecting these variables to change in such contexts.  The previous patch
did not cover this case because assign hooks don't really have enough
information, so move the responsibility for preventing this into guc.c.

Problem discovered by Heikki Linnakangas.

Security: no CVE assigned yet, extends CVE-2007-6600

15 years agoTranslation updates
Peter Eisentraut [Thu, 3 Sep 2009 18:59:02 +0000 (18:59 +0000)] 
Translation updates

15 years agoUpdate time zone data files to tzdata release 2009l: DST law changes in
Tom Lane [Thu, 3 Sep 2009 04:45:12 +0000 (04:45 +0000)] 
Update time zone data files to tzdata release 2009l: DST law changes in
Egypt, Mauritius, Bangladesh.

15 years agoFix pg_ctl's readfile() to not go into infinite loop on an empty file
Tom Lane [Wed, 2 Sep 2009 02:41:27 +0000 (02:41 +0000)] 
Fix pg_ctl's readfile() to not go into infinite loop on an empty file
(could happen if either postgresql.conf or postmaster.opts is empty).
It's been broken since the C version was written for 8.0, so patch
all the way back.

initdb's copy of the function is broken in the same way, but it's
less important there since the input files should never be empty.
Patch that in HEAD only, and also fix some cosmetic differences that
crept into that copy of the function.

Per report from Corry Haines and Jeff Davis.

15 years agoUpdate release notes for 7.4.26, 8.0.22, 8.1.18, 8.2.14, 8.3.8, 8.4.1.
Bruce Momjian [Thu, 27 Aug 2009 01:26:51 +0000 (01:26 +0000)] 
Update release notes for 7.4.26, 8.0.22, 8.1.18, 8.2.14, 8.3.8, 8.4.1.

15 years agoFix inclusions of readline/editline header files so that we only attempt to
Tom Lane [Mon, 24 Aug 2009 16:18:42 +0000 (16:18 +0000)] 
Fix inclusions of readline/editline header files so that we only attempt to
#include the version of history.h that is in the same directory as the
readline.h we are using.  This avoids problems in some scenarios where both
readline and editline are installed.  Report and patch by Zdenek Kotala.

15 years agoFix overflow for INTERVAL 'x ms' where x is more than a couple million,
Tom Lane [Tue, 18 Aug 2009 21:23:50 +0000 (21:23 +0000)] 
Fix overflow for INTERVAL 'x ms' where x is more than a couple million,
and integer datetimes are in use.  Per bug report from Hubert Depesz
Lubaczewski.

Alex Hunsaker

15 years agoRemove tabs from SGML.
Bruce Momjian [Sat, 15 Aug 2009 20:22:50 +0000 (20:22 +0000)] 
Remove tabs from SGML.

15 years agoRe-add documentation for --no-readline option of psql, mistakenly removed a decade...
Andrew Dunstan [Mon, 10 Aug 2009 02:39:12 +0000 (02:39 +0000)] 
Re-add documentation for --no-readline option of psql, mistakenly removed a decade ago. Backpatch to release 7.4.

15 years agoTry to defend against the possibility that libpq is still in COPY_IN state
Tom Lane [Fri, 7 Aug 2009 20:16:41 +0000 (20:16 +0000)] 
Try to defend against the possibility that libpq is still in COPY_IN state
when we reach the post-COPY "pump it dry" error recovery code that was added
2006-11-24.  Per a report from Neil Best, there is at least one code path
in which this occurs, leading to an infinite loop in code that's supposed
to be making it more robust not less so.  A reasonable response seems to be
to call PQputCopyEnd() again, so let's try that.

Back-patch to all versions that contain the cleanup loop.

16 years agoFix xslt_process() to ensure that it inserts a NULL terminator after the
Tom Lane [Fri, 10 Jul 2009 00:32:29 +0000 (00:32 +0000)] 
Fix xslt_process() to ensure that it inserts a NULL terminator after the
last pair of parameter name/value strings, even when there are MAXPARAMS
of them.  Aboriginal bug in contrib/xml2, noted while studying bug #4912
(though I'm not sure whether there's something else involved in that
report).

This might be thought a security issue, since it's a potential backend
crash; but considering that untrustworthy users shouldn't be allowed
to get their hands on xslt_process() anyway, it's probably not worth
getting excited about.

16 years agoFix ancient bug in handling of to_char modifier 'TH', when used with HH.
Heikki Linnakangas [Mon, 6 Jul 2009 19:12:12 +0000 (19:12 +0000)] 
Fix ancient bug in handling of to_char modifier 'TH', when used with HH.
In what seems like an oversight, we used to treat 'TH' the same as lowercase
'th', but only with HH/HH12.

16 years agoFix an ancient error in dist_ps (distance from point to line segment), which
Tom Lane [Tue, 23 Jun 2009 16:25:28 +0000 (16:25 +0000)] 
Fix an ancient error in dist_ps (distance from point to line segment), which
a number of other geometric operators also depend on.  It miscalculated the
slope of the perpendicular to the given line segment anytime that slope was
other than 0, infinite, or +/-1.  In some cases the error would be masked
because the true closest point on the line segment was one of its endpoints
rather than the intersection point, but in other cases it could give an
arbitrarily bad answer.  Per bug #4872 from Nick Roosevelt.

Bug goes clear back to Berkeley days, so patch all supported branches.
Make a couple of cosmetic adjustments while at it.

16 years agoUpdate time zone data files to tzdata release 2009i: DST law changes in
Tom Lane [Thu, 11 Jun 2009 17:46:10 +0000 (17:46 +0000)] 
Update time zone data files to tzdata release 2009i: DST law changes in
Bangladesh, Egypt, Jordan, Pakistan.

16 years agoImprove capitalization and punctuation in recently added GiST message.
Peter Eisentraut [Wed, 10 Jun 2009 18:43:24 +0000 (18:43 +0000)] 
Improve capitalization and punctuation in recently added GiST message.

16 years agoFix cash_in() to behave properly in locales where frac_digits is zero,
Tom Lane [Wed, 10 Jun 2009 16:31:56 +0000 (16:31 +0000)] 
Fix cash_in() to behave properly in locales where frac_digits is zero,
eg Japan.  Report and fix by Itagaki Takahiro.  Also fix CASHDEBUG printout
format for branches with 64-bit money type, and some minor comment cleanup.

Back-patch to 7.4, because it's broken all the way back.

16 years agoAdjust recent PERL_SYS_INIT3 call to avoid platforms where it might fail, and to...
Andrew Dunstan [Fri, 5 Jun 2009 20:32:58 +0000 (20:32 +0000)] 
Adjust recent PERL_SYS_INIT3 call to avoid platforms where it might fail, and to remove compilation warning. Backpatch the release 7.4

16 years agoInitialise perl library as documented in perl API. Backpatch to release 7.4.
Andrew Dunstan [Thu, 4 Jun 2009 16:01:03 +0000 (16:01 +0000)] 
Initialise perl library as documented in perl API. Backpatch to release 7.4.

16 years agoSplit the release notes into a separate file for each (active) major branch,
Tom Lane [Sat, 2 May 2009 20:18:09 +0000 (20:18 +0000)] 
Split the release notes into a separate file for each (active) major branch,
as per my recent proposal.  release.sgml itself is now just a stub that should
change rarely; ideally, only once per major release to add a new include line.
Most editing work will occur in the release-N.N.sgml files.  To update a back
branch for a minor release, just copy the appropriate release-N.N.sgml
file(s) into the back branch.

This commit doesn't change the end-product documentation at all, only the
source layout.  However, it makes it easy to start omitting ancient information
from newer branches' documentation, should we ever decide to do that.

16 years agoWhen checking for datetime field overflow, we should allow a fractional-second
Tom Lane [Fri, 1 May 2009 19:29:34 +0000 (19:29 +0000)] 
When checking for datetime field overflow, we should allow a fractional-second
part that rounds up to exactly 1.0 second.  The previous coding rejected input
like "00:12:57.9999999999999999999999999999", with the exact number of nines
needed to cause failure varying depending on float-timestamp option and
possibly on platform.  Obviously this should round up to the next integral
second, if we don't have enough precision to distinguish the value from that.
Per bug #4789 from Robert Kruus.

In passing, fix a missed check for fractional seconds in one copy of the
"is it greater than 24:00:00" code.

Broken all the way back, so patch all the way back.

16 years agoFix the handling of sub-SELECTs appearing in the arguments of an outer-level
Tom Lane [Sat, 25 Apr 2009 16:45:25 +0000 (16:45 +0000)] 
Fix the handling of sub-SELECTs appearing in the arguments of an outer-level
aggregate function.  By definition, such a sub-SELECT cannot reference any
variables of query levels between itself and the aggregate's semantic level
(else the aggregate would've been assigned to that lower level instead).
So the correct, most efficient implementation is to treat the sub-SELECT as
being a sub-select of that outer query level, not the level the aggregate
syntactically appears in.  Not doing so also confuses the heck out of our
parameter-passing logic, as illustrated in bug report from Daniel Grace.

Fortunately, we were already copying the whole Aggref expression up to the
outer query level, so all that's needed is to delay SS_process_sublinks
processing of the sub-SELECT until control returns to the outer level.

This has been broken since we introduced spec-compliant treatment of
outer aggregates in 7.4; so patch all the way back.

16 years agoRemove HELIOS Software GmbH name and copyright from AIX dynloader files,
Bruce Momjian [Sat, 25 Apr 2009 15:53:34 +0000 (15:53 +0000)] 
Remove HELIOS Software GmbH name and copyright from AIX dynloader files,
per approval from Helmut Tschemernjak, President.

Only back branches;  files removed from CVS HEAD.

16 years agoRemove beer-ware license from crypt-md5.c, per
Magnus Hagander [Wed, 15 Apr 2009 18:58:28 +0000 (18:58 +0000)] 
Remove beer-ware license from crypt-md5.c, per
approval from Poul-Henning Kamp.

This makes the file the same standard 2-clause BSD as the
rest of PostgreSQL.

16 years agoUpdate time zone data files to tzdata release 2009e: DST law changes in
Tom Lane [Thu, 9 Apr 2009 20:51:11 +0000 (20:51 +0000)] 
Update time zone data files to tzdata release 2009e: DST law changes in
Argentina/San_Luis, Cuba, Jordan (historical correction only), Morocco,
Palestine, Syria, Tunisia.

16 years agoFix 'all at one page bug' in picksplit method of R-tree emulation. Add defense
Teodor Sigaev [Tue, 7 Apr 2009 17:48:11 +0000 (17:48 +0000)] 
Fix 'all at one page bug' in picksplit method of R-tree emulation. Add defense
from buggy user-defined picksplit to GiST.

16 years agoDefend against non-ASCII letters in fuzzystrmatch code. The functions
Tom Lane [Tue, 7 Apr 2009 15:54:22 +0000 (15:54 +0000)] 
Defend against non-ASCII letters in fuzzystrmatch code.  The functions
still don't behave very sanely for multibyte encodings, but at least
they won't be indexing off the ends of static arrays.

16 years agoRewrite interval_hash() so that the hashcodes are equal for values that
Tom Lane [Sat, 4 Apr 2009 04:53:58 +0000 (04:53 +0000)] 
Rewrite interval_hash() so that the hashcodes are equal for values that
interval_eq() considers equal.  I'm not sure how that fundamental requirement
escaped us through multiple revisions of this hash function, but there it is;
it's been wrong since interval_hash was first written for PG 7.1.
Per bug #4748 from Roman Kononov.

Backpatch to all supported releases.

This patch changes the contents of hash indexes for interval columns.  That's
no particular problem for PG 8.4, since we've broken on-disk compatibility
of hash indexes already; but it will require a migration warning note in
the next minor releases of all existing branches: "if you have any hash
indexes on columns of type interval, REINDEX them after updating".

16 years agoFix contrib/pgstattuple and contrib/pageinspect to prevent attempts to read
Tom Lane [Tue, 31 Mar 2009 22:56:18 +0000 (22:56 +0000)] 
Fix contrib/pgstattuple and contrib/pageinspect to prevent attempts to read
temporary tables of other sessions; that is unsafe because of the way our
buffer management works.  Per report from Stuart Bishop.
This is redundant with the bufmgr.c checks in HEAD, but not at all redundant
in the back branches.

16 years agoDon't crash initdb when we fail to get the current username.
Magnus Hagander [Tue, 31 Mar 2009 18:58:20 +0000 (18:58 +0000)] 
Don't crash initdb when we fail to get the current username.
Give an error message and exit instead, like we do elsewhere...

Per report from Wez Furlong and Robert Treat.

16 years agotag 8.0.21 REL8_0_21
Marc G. Fournier [Fri, 13 Mar 2009 02:30:37 +0000 (02:30 +0000)] 
tag 8.0.21

16 years agoUpdate back-branch release notes.
Tom Lane [Thu, 12 Mar 2009 22:36:33 +0000 (22:36 +0000)] 
Update back-branch release notes.

16 years agoFix core dump due to null-pointer dereference in to_char() when datetime
Tom Lane [Thu, 12 Mar 2009 00:53:56 +0000 (00:53 +0000)] 
Fix core dump due to null-pointer dereference in to_char() when datetime
format codes are misapplied to a numeric argument.  (The code still produces
a pretty bogus error message in such cases, but I'll settle for stopping the
crash for now.)  Per bug #4700 from Sergey Burladyan.

Problem exists in all supported branches, so patch all the way back.
In HEAD, also clean up some ugly coding in the nearby cache management
code.

16 years agoAdd MUST (Mauritius Island Summer Time) to the list of known abbreviations.
Heikki Linnakangas [Thu, 5 Mar 2009 14:29:12 +0000 (14:29 +0000)] 
Add MUST (Mauritius Island Summer Time) to the list of known abbreviations.
Mauritius began using DST in the summer 2008-2009; the Olson library has been
updated already.

Xavier Bugaud

16 years agoPut back our old workaround for machines that declare cbrt() in math.h but
Tom Lane [Wed, 4 Mar 2009 22:08:46 +0000 (22:08 +0000)] 
Put back our old workaround for machines that declare cbrt() in math.h but
fail to provide the function itself.  Not sure how we escaped testing anything
later than 7.3 on such cases, but they still exist, as per André Volpato's
report about AIX 5.3.

16 years agoOoops ... fix some confusion between gettext() and _() in my previous patch.
Tom Lane [Tue, 3 Mar 2009 00:17:36 +0000 (00:17 +0000)] 
Ooops ... fix some confusion between gettext() and _() in my previous patch.
This has moved around in past releases, so just copying-and-pasting from HEAD
didn't work as intended.

16 years agoWhen we are in error recursion trouble, arrange to suppress translation and
Tom Lane [Mon, 2 Mar 2009 21:19:14 +0000 (21:19 +0000)] 
When we are in error recursion trouble, arrange to suppress translation and
encoding conversion of any elog/ereport message being sent to the frontend.
This generalizes a patch that I put in last October, which suppressed
translation of only specific messages known to be associated with recursive
can't-translate-the-message behavior.  As shown in bug #4680, we need a more
general answer in order to have some hope of coping with broken encoding
conversion setups.  This approach seems a good deal less klugy anyway.

Patch in all supported branches.

16 years agoFix buffer allocations in encoding conversion routines so that they won't
Tom Lane [Sat, 28 Feb 2009 18:50:14 +0000 (18:50 +0000)] 
Fix buffer allocations in encoding conversion routines so that they won't
fail on zero-length inputs.  This isn't an issue in normal use because the
conversion infrastructure skips calling the converters for empty strings.
However a problem was created by yesterday's patch to check whether the
right conversion function is supplied in CREATE CONVERSION.  The most
future-proof fix seems to be to make the converters safe for this corner case.

16 years agoIn CREATE CONVERSION, test that the given function is a valid conversion
Heikki Linnakangas [Fri, 27 Feb 2009 16:35:47 +0000 (16:35 +0000)] 
In CREATE CONVERSION, test that the given function is a valid conversion
function for the specified source and destination encodings. We do that by
calling the function with an empty string. If it can't perform the requested
conversion, it will throw an error.

Backport to 7.4 - 8.3. Per bug report #4680 by Denis Afonin.

16 years agocommit first then tag 8.0.20 REL8_0_20
Marc G. Fournier [Fri, 30 Jan 2009 04:59:15 +0000 (04:59 +0000)] 
commit first then tag 8.0.20

16 years agoUpdate back-branch release notes.
Tom Lane [Fri, 30 Jan 2009 00:38:14 +0000 (00:38 +0000)] 
Update back-branch release notes.

16 years agoTranslation updates
Peter Eisentraut [Thu, 29 Jan 2009 22:04:05 +0000 (22:04 +0000)] 
Translation updates

16 years agoUpdate time zone data files to tzdata release 2009a: introduces Asia/Kathmandu
Tom Lane [Thu, 29 Jan 2009 20:00:32 +0000 (20:00 +0000)] 
Update time zone data files to tzdata release 2009a: introduces Asia/Kathmandu
as the preferred spelling of that zone name, corrects historical DST
information for Switzerland and Cuba.

16 years agoReplace argument-checking Asserts with regular test-and-elog checks in all
Tom Lane [Thu, 29 Jan 2009 19:25:01 +0000 (19:25 +0000)] 
Replace argument-checking Asserts with regular test-and-elog checks in all
encoding conversion functions.  These are not can't-happen cases because
it's possible to create a conversion with the wrong conversion function
for the specified encoding pair.  That would lead to an Assert crash in
an Assert-enabled build, or incorrect conversion otherwise, neither of
which is desirable.  This would be a DOS issue if production databases
were customarily built with asserts enabled, but fortunately that's not so.
Per an observation by Heikki.

Back-patch to all supported branches.

16 years agoGo over all OpenSSL return values and make sure we compare them
Magnus Hagander [Wed, 28 Jan 2009 15:06:51 +0000 (15:06 +0000)] 
Go over all OpenSSL return values and make sure we compare them
to the documented API value. The previous code got it right as
it's implemented, but accepted too much/too little compared to
the API documentation.

Per comment from Zdenek Kotala.

16 years agoFix uninitialized variables in get_covers
Teodor Sigaev [Fri, 16 Jan 2009 12:09:30 +0000 (12:09 +0000)] 
Fix uninitialized variables in get_covers

16 years agoFix URL generation in headline. Only tag lexeme will be replaced by space.
Teodor Sigaev [Thu, 15 Jan 2009 18:17:12 +0000 (18:17 +0000)] 
Fix URL generation in headline. Only tag lexeme will be replaced by space.
Per http://archives.postgresql.org/pgsql-bugs/2008-12/msg00013.php

16 years agoFix generation of too long headline with ShortWords.
Teodor Sigaev [Thu, 15 Jan 2009 18:16:52 +0000 (18:16 +0000)] 
Fix generation of too long headline with ShortWords.
Per http://archives.postgresql.org/pgsql-hackers/2008-09/msg01088.php

16 years agoRemove references to pgsql-ports and pgsql-patches mailing lists from
Tom Lane [Tue, 6 Jan 2009 17:28:01 +0000 (17:28 +0000)] 
Remove references to pgsql-ports and pgsql-patches mailing lists from
various documentation, since those lists are now dead/deprecated.
Point to pgsql-bugs and/or pgsql-hackers as appropriate.

16 years agoFix logic in lazy vacuum to decide if it's worth trying to truncate the heap.
Heikki Linnakangas [Tue, 6 Jan 2009 14:56:03 +0000 (14:56 +0000)] 
Fix logic in lazy vacuum to decide if it's worth trying to truncate the heap.
If the table was smaller than REL_TRUNCATE_FRACTION (= 16) pages, we always
tried to acquire AccessExclusiveLock on it even if there was no empty pages
at the end.

Report by Simon Riggs. Back-patch all the way to 7.4.

16 years agotag for 8.0.19 REL8_0_19
Marc G. Fournier [Fri, 31 Oct 2008 02:54:50 +0000 (02:54 +0000)] 
tag for 8.0.19

16 years agoUpdate back-branch release notes.
Tom Lane [Thu, 30 Oct 2008 22:23:25 +0000 (22:23 +0000)] 
Update back-branch release notes.

16 years agoTranslation updates
Peter Eisentraut [Thu, 30 Oct 2008 19:21:26 +0000 (19:21 +0000)] 
Translation updates

16 years agoUpdate time zone data files to tzdata release 2008i (DST law changes in
Tom Lane [Thu, 30 Oct 2008 13:17:23 +0000 (13:17 +0000)] 
Update time zone data files to tzdata release 2008i (DST law changes in
Argentina, Brazil, Mauritius, Syria).

16 years agoMissing space in error message
Peter Eisentraut [Thu, 30 Oct 2008 12:16:32 +0000 (12:16 +0000)] 
Missing space in error message

16 years agoInstall a more robust solution for the problem of infinite error-processing
Tom Lane [Mon, 27 Oct 2008 19:37:48 +0000 (19:37 +0000)] 
Install a more robust solution for the problem of infinite error-processing
recursion when we are unable to convert a localized error message to the
client's encoding.  We've been over this ground before, but as reported by
Ibrar Ahmed, it still didn't work in the case of conversion failures for
the conversion-failure message itself :-(.  Fix by installing a "circuit
breaker" that disables attempts to localize this message once we get into
recursion trouble.

Patch all supported branches, because it is in fact broken in all of them;
though I had to add some missing translations to the older branches in
order to expose the failure in the particular test case I was using.

16 years agoFix an old bug in after-trigger handling: AfterTriggerEndQuery took the
Tom Lane [Sat, 25 Oct 2008 03:33:05 +0000 (03:33 +0000)] 
Fix an old bug in after-trigger handling: AfterTriggerEndQuery took the
address of afterTriggers->query_stack[afterTriggers->query_depth] and hung
onto it through all its firings of triggers.  However, if a trigger causes
sufficiently many nested query executions, query_stack will get repalloc'd
bigger, leaving AfterTriggerEndQuery --- and hence afterTriggerInvokeEvents
--- using a stale pointer.

So far as I can find, the only consequence of this error is to stomp on a
couple of words of already-freed memory; which would lead to a failure only if
that chunk had already gotten re-allocated for something else.  So it's hard
to exhibit a simple failure case, but this is surely a bug.

I noticed this while working on my recent patch to reduce pending-trigger
space usage.  The present patch is mighty ugly, because it requires making
afterTriggerInvokeEvents know about all the possible event lists it might get
called on.  Fortunately, this is only needed in back branches because CVS HEAD
avoids the problem in a different way: afterTriggerInvokeEvents only touches
the passed AfterTriggerEventList pointer once at startup.  Back branches are
stable enough that wiring in knowledge of all possible call usages doesn't
seem like a killer problem.

Back-patch to 8.0.  7.4's trigger code is completely different and doesn't
seem to have the problem (it doesn't even use repalloc).

16 years agoFix small bug in headline generation.
Teodor Sigaev [Fri, 17 Oct 2008 17:42:32 +0000 (17:42 +0000)] 
Fix small bug in headline generation.
Patch from Sushant Sinha <sushant354@gmail.com>
http://archives.postgresql.org/pgsql-hackers/2008-07/msg00785.php

16 years agoFix SPI_getvalue and SPI_getbinval to range-check the given attribute number
Tom Lane [Thu, 16 Oct 2008 13:23:49 +0000 (13:23 +0000)] 
Fix SPI_getvalue and SPI_getbinval to range-check the given attribute number
according to the TupleDesc's natts, not the number of physical columns in the
tuple.  The previous coding would do the wrong thing in cases where natts is
different from the tuple's column count: either incorrectly report error when
it should just treat the column as null, or actually crash due to indexing off
the end of the TupleDesc's attribute array.  (The second case is probably not
possible in modern PG versions, due to more careful handling of inheritance
cases than we once had.  But it's still a clear lack of robustness here.)

The incorrect error indication is ignored by all callers within the core PG
distribution, so this bug has no symptoms visible within the core code, but
it might well be an issue for add-on packages.  So patch all the way back.

16 years agoOptional argument should be optional.
Michael Meskes [Fri, 10 Oct 2008 12:19:18 +0000 (12:19 +0000)] 
Optional argument should be optional.

16 years agoFix overly tense optimization of PLpgSQL_func_hashkey: we must represent
Tom Lane [Thu, 9 Oct 2008 16:35:33 +0000 (16:35 +0000)] 
Fix overly tense optimization of PLpgSQL_func_hashkey: we must represent
the isTrigger state explicitly, not rely on nonzero-ness of trigrelOid
to indicate trigger-hood, because trigrelOid will be left zero when compiling
for validation.  The (useless) function hash entry built by the validator
was able to match an ordinary non-trigger call later in the same session,
thereby bypassing the check that is supposed to prevent such a call.
Per report from Alvaro.

It might be worth suppressing the useless hash entry altogether, but
that's a bigger change than I want to consider back-patching.

Back-patch to 8.0.  7.4 doesn't have the problem because it doesn't
have validation mode.

16 years agoFix improper display of fractional seconds in interval values
Tom Lane [Thu, 2 Oct 2008 13:48:03 +0000 (13:48 +0000)] 
Fix improper display of fractional seconds in interval values
when using --enable-integer-datetimes and a non-ISO datestyle.

Ron Mayer

16 years agoRecent patches to pg_ctl broke "pg_ctl restart" for the case where no
Tom Lane [Tue, 30 Sep 2008 13:14:28 +0000 (13:14 +0000)] 
Recent patches to pg_ctl broke "pg_ctl restart" for the case where no
command-line options had been given to the postmaster; and just plain
broke it altogether in 8.1 and 8.0.  Per report from KaiGai Kohei.

16 years agotag for 8.0.18 REL8_0_18
Marc G. Fournier [Fri, 19 Sep 2008 03:23:34 +0000 (03:23 +0000)] 
tag for 8.0.18

16 years agoUpdate back-branch release notes.
Tom Lane [Fri, 19 Sep 2008 02:45:56 +0000 (02:45 +0000)] 
Update back-branch release notes.

16 years agoUpdate time zone data files to tzdata release 2008f (DST law changes in
Tom Lane [Wed, 17 Sep 2008 14:19:10 +0000 (14:19 +0000)] 
Update time zone data files to tzdata release 2008f (DST law changes in
Argentina, Bahamas, Brazil, Mauritius, Morocco, Pakistan, Palestine, Paraguay).

16 years agoWiden the nLocks counts in local lock tables from int to int64. This
Tom Lane [Tue, 16 Sep 2008 01:56:56 +0000 (01:56 +0000)] 
Widen the nLocks counts in local lock tables from int to int64.  This
forestalls potential overflow when the same table (or other object, but
usually tables) is accessed by very many successive queries within a single
transaction.  Per report from Michael Milligan.

Back-patch to 8.0, which is as far back as the patch conveniently applies.
There have been no reports of overflow in pre-8.3 releases, but clearly the
risk existed all along.  (Michael's report suggests that 8.3 may consume lock
counts faster than prior releases, but with no test case to look at it's hard
to be sure about that.  Widening the counts seems a good future-proofing
measure in any event.)

16 years agoFix pg_dump docs to acknowledge that you can use -Z with plain text output. Pointed...
Tom Lane [Tue, 26 Aug 2008 00:03:43 +0000 (00:03 +0000)] 
Fix pg_dump docs to acknowledge that you can use -Z with plain text output.  Pointed out by Daniel Migowski.

16 years agoFix pg_dump/pg_restore's ExecuteSqlCommand() to behave suitably if PQexec
Tom Lane [Sat, 16 Aug 2008 02:25:30 +0000 (02:25 +0000)] 
Fix pg_dump/pg_restore's ExecuteSqlCommand() to behave suitably if PQexec
returns NULL instead of a PGresult.  The former coding would fail, which
is OK, but it neglected to give you the PQerrorMessage that might tell
you why.  In the oldest branches, there was another problem: it'd sometimes
report PQerrorMessage from the wrong connection.

16 years agoInstall checks in executor startup to ensure that the tuples produced by an
Tom Lane [Fri, 8 Aug 2008 17:01:41 +0000 (17:01 +0000)] 
Install checks in executor startup to ensure that the tuples produced by an
INSERT or UPDATE will match the target table's current rowtype.  In pre-8.3
releases inconsistency can arise with stale cached plans, as reported by
Merlin Moncure.  (We patched the equivalent hazard on the SELECT side in Feb
2007; I'm not sure why we thought there was no risk on the insertion side.)
In 8.3 and HEAD this problem should be impossible due to plan cache
invalidation management, but it seems prudent to make the check anyway.

Back-patch as far as 8.0.  7.x versions lack ALTER COLUMN TYPE, so there
seems no way to abuse a stale plan comparably.

16 years agoDo not allow Unique nodes to be scanned backwards. The code claimed that it
Tom Lane [Tue, 5 Aug 2008 21:28:54 +0000 (21:28 +0000)] 
Do not allow Unique nodes to be scanned backwards.  The code claimed that it
would work, but in fact it didn't return the same rows when moving backwards
as when moving forwards.  This would have no visible effect in a DISTINCT
query (at least assuming the column datatypes use a strong definition of
equality), but it gave entirely wrong answers for DISTINCT ON queries.

16 years agoUpdate 8.1 and 8.0 plpython to work with Python 2.5. This backports several
Tom Lane [Mon, 28 Jul 2008 18:45:18 +0000 (18:45 +0000)] 
Update 8.1 and 8.0 plpython to work with Python 2.5.  This backports several
fixes made during the 8.2 development cycle, but not backported at the time
for lack of confidence in the new coding.

I didn't touch 7.4 because it has more problems than this: the configure
probe for Python fails.

17 years agoFix performance bug in write_syslog(): the code to preferentially break the
Tom Lane [Tue, 8 Jul 2008 22:18:09 +0000 (22:18 +0000)] 
Fix performance bug in write_syslog(): the code to preferentially break the
log message at newlines cost O(N^2) for very long messages with few or no
newlines.  For messages in the megabyte range this became the dominant cost.
Per gripe from Achilleas Mantzios.

Patch all the way back, since this is a safe change with no portability
risks.  I am also thinking of increasing PG_SYSLOG_LIMIT, but that should
be done separately.

17 years agoFix estimate_num_groups() to assume that GROUP BY expressions yielding boolean
Tom Lane [Mon, 7 Jul 2008 20:25:30 +0000 (20:25 +0000)] 
Fix estimate_num_groups() to assume that GROUP BY expressions yielding boolean
results always contribute two groups, regardless of the expression contents.
This is very substantially more accurate than the regular heuristic for
certain boolean tests like "col IS NULL".  Per gripe from Sam Mason.

Back-patch to all supported releases, since the behavior of
estimate_num_groups() hasn't changed all that much since 7.4.

17 years agoFix identify_system_timezone() so that it tests the behavior of the system
Tom Lane [Tue, 1 Jul 2008 03:41:25 +0000 (03:41 +0000)] 
Fix identify_system_timezone() so that it tests the behavior of the system
timezone setting in the current year and for 100 years back, rather than
always examining years 1904-2004.  The original coding would have problems
distinguishing zones whose behavior diverged only after 2004; which is a
situation we will surely face sometime, if it's not out there already.

In passing, also prevent selection of the dummy "Factory" timezone, even
if that's exactly what the system is using.  Reporting time as GMT seems
better than that.

17 years agoFix 'pg_ctl reload' to properly preserve postmaster commend-line
Bruce Momjian [Fri, 27 Jun 2008 01:52:58 +0000 (01:52 +0000)] 
Fix 'pg_ctl reload' to properly preserve postmaster commend-line
arguments on restart.  Patch to releases 8.0 - 8.3.X.

17 years agoClean up a number of bogosities around pltcl's handling of the Tcl "result":
Tom Lane [Tue, 17 Jun 2008 00:53:13 +0000 (00:53 +0000)] 
Clean up a number of bogosities around pltcl's handling of the Tcl "result":

1. Directly reading interp->result is deprecated in Tcl 8.0 and later;
you're supposed to use Tcl_GetStringResult.  This code finally broke with
Tcl 8.5, because Tcl_GetVar can now have side-effects on interp->result even
though it preserves the logical state of the result.  (There's arguably a
Tcl issue here, because Tcl_GetVar could invalidate the pointer result of a
just-preceding Tcl_GetStringResult, but I doubt the Tcl guys will see it as
a bug.)

2. We were being sloppy about the encoding of the result: some places would
push database-encoding data into the Tcl result, which should not happen,
and we were assuming that any error result coming back from Tcl was in the
database encoding, which is not a good assumption.

3. There were a lot of calls of Tcl_SetResult that uselessly specified
TCL_VOLATILE for constant strings.  This is only a minor performance issue,
but I fixed it in passing since I had to look at all the calls anyway.

#2 is a live bug regardless of which Tcl version you are interested in,
so back-patch even to branches that are unlikely to be used with Tcl 8.5.
I went back as far as 8.0, which is as far as the patch applied easily;
7.4 was using a different error processing scheme that has got its own
problems :-(

17 years agoCreate a script to handle stamping release version numbers into files,
Tom Lane [Tue, 10 Jun 2008 18:09:15 +0000 (18:09 +0000)] 
Create a script to handle stamping release version numbers into files,
replacing the tedious and error-prone manual process we've been using.

17 years agoFix datetime input functions to correctly detect integer overflow when
Tom Lane [Mon, 9 Jun 2008 19:34:31 +0000 (19:34 +0000)] 
Fix datetime input functions to correctly detect integer overflow when
running on a 64-bit platform ... strtol() will happily return 64-bit
output in that case.  Per bug #4231 from Geoff Tolley.

17 years agotag 8.0.17 REL8_0_17
Tom Lane [Mon, 9 Jun 2008 00:18:48 +0000 (00:18 +0000)] 
tag 8.0.17

17 years agoStamp 8.0.17 (except for configure.in/configure)
Tom Lane [Sun, 8 Jun 2008 22:15:07 +0000 (22:15 +0000)] 
Stamp 8.0.17 (except for configure.in/configure)

17 years agoUpdate release notes for 8.3.3 et al.
Tom Lane [Sat, 7 Jun 2008 22:11:25 +0000 (22:11 +0000)] 
Update release notes for 8.3.3 et al.

17 years agoFix pg_get_ruledef() so that negative numeric constants are parenthesized.
Tom Lane [Fri, 6 Jun 2008 18:00:00 +0000 (18:00 +0000)] 
Fix pg_get_ruledef() so that negative numeric constants are parenthesized.
This is needed because :: casting binds more tightly than minus, so for
example -1::integer is not the same as (-1)::integer, and there are cases
where the difference is important.  In particular this caused a failure
in SELECT DISTINCT ... ORDER BY ... where expressions that should have
matched were seen as different by the parser; but I suspect that there
could be other cases where failure to parenthesize leads to subtler
semantic differences in reloaded rules.  Per report from Alexandr Popov.

17 years agoRemove link that pre-8.2 doc tools don't support. REL8_0_16
Tom Lane [Fri, 6 Jun 2008 05:33:52 +0000 (05:33 +0000)] 
Remove link that pre-8.2 doc tools don't support.

17 years agotag 8.0.16
Tom Lane [Fri, 6 Jun 2008 04:32:15 +0000 (04:32 +0000)] 
tag 8.0.16

17 years agoStamp 8.0.16 (except for configure.in/configure)
Tom Lane [Thu, 5 Jun 2008 23:56:24 +0000 (23:56 +0000)] 
Stamp 8.0.16 (except for configure.in/configure)

17 years agoTranslation updates.
Tom Lane [Thu, 5 Jun 2008 23:37:32 +0000 (23:37 +0000)] 
Translation updates.

17 years agoDraft release notes for upcoming back-branch updates.
Tom Lane [Wed, 4 Jun 2008 03:16:46 +0000 (03:16 +0000)] 
Draft release notes for upcoming back-branch updates.

17 years agoUpdate time zone data files to tzdata release 2008c (DST law changes in
Tom Lane [Sun, 1 Jun 2008 18:23:30 +0000 (18:23 +0000)] 
Update time zone data files to tzdata release 2008c (DST law changes in
Morocco, Iraq, Choibalsan, Pakistan, Syria, Cuba, Argentina/San_Luis).

17 years agoImprove GRANT documentation to point out that UPDATE and DELETE typically
Tom Lane [Wed, 28 May 2008 00:46:05 +0000 (00:46 +0000)] 
Improve GRANT documentation to point out that UPDATE and DELETE typically
require SELECT privilege as well, since you normally need to read existing
column values within such commands.  This behavior is according to spec,
but we'd never documented it before.  Per gripe from Volkan Yazici.

17 years agoBack-patch the 8.3 fix that prohibits TRUNCATE, CLUSTER, and REINDEX when the
Tom Lane [Tue, 27 May 2008 21:13:50 +0000 (21:13 +0000)] 
Back-patch the 8.3 fix that prohibits TRUNCATE, CLUSTER, and REINDEX when the
current transaction has any open references to the target relation or index
(implying it has an active query using the relation).  Also back-patch the
8.2 fix that prohibits TRUNCATE and CLUSTER when there are pending
AFTER-trigger events.  Per suggestion from Heikki.

17 years agoFix an old corner-case bug in set_config_option: push_old_value has to be
Tom Lane [Mon, 26 May 2008 18:54:59 +0000 (18:54 +0000)] 
Fix an old corner-case bug in set_config_option: push_old_value has to be
called before, not after, calling the assign_hook if any.  This is because
push_old_value might fail (due to palloc out-of-memory), and in that case
there would be no stack entry to tell transaction abort to undo the GUC
assignment.  Of course the actual assignment to the GUC variable hasn't
happened yet --- but the assign_hook might have altered subsidiary state.
Without a stack entry we won't call it again to make it undo such actions.
So this is necessary to make the world safe for assign_hooks with side
effects.  Per a discussion a couple weeks ago with Magnus.

Back-patch to 8.0.  7.x did not have the problem because it did not have
allocatable stacks of GUC values.

17 years agoAdjust timestamp regression tests to prevent two low-probability failure
Tom Lane [Sun, 25 May 2008 21:51:30 +0000 (21:51 +0000)] 
Adjust timestamp regression tests to prevent two low-probability failure
cases.  Recent buildfarm experience shows that it is sometimes possible
to execute several SQL commands in less time than the granularity of
Windows' not-very-high-resolution gettimeofday(), leading to a failure
because the tests expect the value of now() to change and it doesn't.
Also, it was recognized some time ago that the same area of the tests
could fail if local midnight passes between the insertion and the checking
of the values for 'yesterday', 'tomorrow', etc.  Clean all this up per
ideas from myself and Greg Stark.

There remains a window for failure if the transaction block is entered
exactly at local midnight (so that 'now' and 'today' have the same value),
but that seems low-probability enough to live with.

Since the point of this change is mostly to eliminate buildfarm noise,
back-patch to all versions we are still actively testing.

17 years agoDon't try to close negative file descriptors, since this can cause
Magnus Hagander [Tue, 13 May 2008 20:53:56 +0000 (20:53 +0000)] 
Don't try to close negative file descriptors, since this can cause
crashes on certain platforms. In particular, the MSVC runtime is known
to do this.

Fixes bug #4162, reported and diagnosed by Javier Pimas

17 years agoFix an ancient oversight in change_varattnos_of_a_node: it neglected to update
Tom Lane [Fri, 9 May 2008 22:37:56 +0000 (22:37 +0000)] 
Fix an ancient oversight in change_varattnos_of_a_node: it neglected to update
varoattno along with varattno.  This resulted in having Vars that were not
seen as equal(), causing inheritance of the "same" constraint from different
parent relations to fail.  An example is

create table pp1 (f1 int check (f1>0));
create table cc1 (f2 text, f3 int) inherits (pp1);
create table cc2(f4 float) inherits(pp1,cc1);

Backpatch as far as 7.4.  (The test case still fails in 7.4, for reasons
that I don't feel like investigating at the moment.)

This is a backpatch commit only.  The fix will be applied in HEAD as part
of the upcoming pg_constraint patch.

17 years agoFix contrib/xml makefile to not override CFLAGS.
Tom Lane [Thu, 8 May 2008 17:12:08 +0000 (17:12 +0000)] 
Fix contrib/xml makefile to not override CFLAGS.

17 years agoFix contrib/xml2 makefile to not override CFLAGS.
Tom Lane [Thu, 8 May 2008 17:11:52 +0000 (17:11 +0000)] 
Fix contrib/xml2 makefile to not override CFLAGS.