]> git.ipfire.org Git - thirdparty/postgresql.git/log
thirdparty/postgresql.git
19 years agoStamp release 8.0.8. REL8_0_8
Tom Lane [Sun, 21 May 2006 21:53:31 +0000 (21:53 +0000)] 
Stamp release 8.0.8.

19 years agoUpdate release notes for upcoming releases.
Tom Lane [Sun, 21 May 2006 21:49:50 +0000 (21:49 +0000)] 
Update release notes for upcoming releases.

19 years agoFix missed \' to '' conversion.
Tom Lane [Sun, 21 May 2006 21:13:50 +0000 (21:13 +0000)] 
Fix missed \' to '' conversion.

19 years agoStamp releases 7.3.15, 7.4.13, and 8.0.8.
Bruce Momjian [Sun, 21 May 2006 20:28:35 +0000 (20:28 +0000)] 
Stamp releases 7.3.15, 7.4.13, and 8.0.8.

19 years agoModify libpq's string-escaping routines to be aware of encoding considerations
Tom Lane [Sun, 21 May 2006 20:20:05 +0000 (20:20 +0000)] 
Modify libpq's string-escaping routines to be aware of encoding considerations
and standard_conforming_strings.  The encoding changes are needed for proper
escaping in multibyte encodings, as per the SQL-injection vulnerabilities
noted in CVE-2006-2313 and CVE-2006-2314.  Concurrent fixes are being applied
to the server to ensure that it rejects queries that may have been corrupted
by attempted SQL injection, but this merely guarantees that unpatched clients
will fail rather than allow injection.  An actual fix requires changing the
client-side code.  While at it we have also fixed these routines to understand
about standard_conforming_strings, so that the upcoming changeover to SQL-spec
string syntax can be somewhat transparent to client code.

Since the existing API of PQescapeString and PQescapeBytea provides no way to
inform them which settings are in use, these functions are now deprecated in
favor of new functions PQescapeStringConn and PQescapeByteaConn.  The new
functions take the PGconn to which the string will be sent as an additional
parameter, and look inside the connection structure to determine what to do.
So as to provide some functionality for clients using the old functions,
libpq stores the latest encoding and standard_conforming_strings values
received from the backend in static variables, and the old functions consult
these variables.  This will work reliably in clients using only one Postgres
connection at a time, or even multiple connections if they all use the same
encoding and string syntax settings; which should cover many practical
scenarios.

Clients that use homebrew escaping methods, such as PHP's addslashes()
function or even hardwired regexp substitution, will require extra effort
to fix :-(.  It is strongly recommended that such code be replaced by use of
PQescapeStringConn/PQescapeByteaConn if at all feasible.

19 years agoAdd a new GUC parameter backslash_quote, which determines whether the SQL
Tom Lane [Sun, 21 May 2006 20:11:25 +0000 (20:11 +0000)] 
Add a new GUC parameter backslash_quote, which determines whether the SQL
parser will allow "\'" to be used to represent a literal quote mark.  The
"\'" representation has been deprecated for some time in favor of the
SQL-standard representation "''" (two single quote marks), but it has been
used often enough that just disallowing it immediately won't do.  Hence
backslash_quote allows the settings "on", "off", and "safe_encoding",
the last meaning to allow "\'" only if client_encoding is a valid server
encoding.  That is now the default, and the reason is that in encodings
such as SJIS that allow 0x5c (ASCII backslash) to be the last byte of a
multibyte character, accepting "\'" allows SQL-injection attacks as per
CVE-2006-2314 (further details will be published after release).  The
"on" setting is available for backward compatibility, but it must not be
used with clients that are exposed to untrusted input.

Thanks to Akio Ishida and Yasuo Ohgaki for identifying this security issue.

19 years agoChange the backend to reject strings containing invalidly-encoded multibyte
Tom Lane [Sun, 21 May 2006 20:06:18 +0000 (20:06 +0000)] 
Change the backend to reject strings containing invalidly-encoded multibyte
characters in all cases.  Formerly we mostly just threw warnings for invalid
input, and failed to detect it at all if no encoding conversion was required.
The tighter check is needed to defend against SQL-injection attacks as per
CVE-2006-2313 (further details will be published after release).  Embedded
zero (null) bytes will be rejected as well.  The checks are applied during
input to the backend (receipt from client or COPY IN), so it no longer seems
necessary to check in textin() and related routines; any string arriving at
those functions will already have been validated.  Conversion failure
reporting (for characters with no equivalent in the destination encoding)
has been cleaned up and made consistent while at it.

Also, fix a few longstanding errors in little-used encoding conversion
routines: win1251_to_iso, win866_to_iso, euc_tw_to_big5, euc_tw_to_mic,
mic_to_euc_tw were all broken to varying extents.

Patches by Tatsuo Ishii and Tom Lane.  Thanks to Akio Ishida and Yasuo Ohgaki
for identifying the security issues.

19 years agoChange \' to '', for SQL standards compliance. Backpatch to 7.3, 7.4,
Bruce Momjian [Sun, 21 May 2006 19:57:40 +0000 (19:57 +0000)] 
Change \' to '', for SQL standards compliance.  Backpatch to 7.3, 7.4,
and 8.0.  Later releases already patched.

19 years agoFix nasty bug in nodeIndexscan.c's detection of duplicate tuples during
Tom Lane [Fri, 19 May 2006 16:30:50 +0000 (16:30 +0000)] 
Fix nasty bug in nodeIndexscan.c's detection of duplicate tuples during
a multiple (OR'ed) indexscan.  It was checking for duplicate
tuple->t_data->t_ctid, when what it should be checking is tuple->t_self.
The trouble situation occurs when a live tuple has t_ctid not pointing to
itself, which can happen if an attempted UPDATE was rolled back.  After a
VACUUM, an unrelated tuple could be installed where the failed update tuple
was, leading to one live tuple's t_ctid pointing to an unrelated tuple.
If one of these tuples is fetched by an earlier OR'ed indexscan and the other
by a later indexscan, nodeIndexscan.c would incorrectly ignore the second
tuple.  The bug exists in all 7.4.* and 8.0.* versions, but not in earlier
or later branches because this code was only used in those releases.  Per
trouble report from Rafael Martinez Guerrero.

19 years agoFix the sense of the test on DH_check()'s return value. This was preventing
Tom Lane [Fri, 12 May 2006 22:44:50 +0000 (22:44 +0000)] 
Fix the sense of the test on DH_check()'s return value.  This was preventing
custom-generated DH parameters from actually being used by the server.
Found by Michael Fuhr.

19 years agoRemove unnecessary .seg/.section directives, per Alan Stange.
Tom Lane [Thu, 11 May 2006 21:58:37 +0000 (21:58 +0000)] 
Remove unnecessary .seg/.section directives, per Alan Stange.

19 years agoBuild server libpgport with all non-FRONTEND object files. This is to
Bruce Momjian [Mon, 8 May 2006 02:18:21 +0000 (02:18 +0000)] 
Build server libpgport with all non-FRONTEND object files.  This is to
fix a Win32 bug where pipe.c included a file that used FRONTEND, but it
wasn't on the server-build list.

19 years agoFix SELECT INTO and CREATE TABLE AS to create tables in the default
Bruce Momjian [Wed, 26 Apr 2006 23:01:13 +0000 (23:01 +0000)] 
Fix SELECT INTO and CREATE TABLE AS to create tables in the default
tablespace, not the base directory.

Kris Jurka

19 years agoFixed memory leak bugs found by Martijn Oosterhout.
Michael Meskes [Mon, 24 Apr 2006 09:45:57 +0000 (09:45 +0000)] 
Fixed memory leak bugs found by Martijn Oosterhout.

19 years agoFix ancient memory leak in PQprintTuples(); our code no longer uses this
Tom Lane [Wed, 19 Apr 2006 16:15:41 +0000 (16:15 +0000)] 
Fix ancient memory leak in PQprintTuples(); our code no longer uses this
routine, but perhaps some applications do.  Found by Martijn van Oosterhout
using Coverity.

19 years agoFix similar_escape() so that SIMILAR TO works properly for patterns involving
Tom Lane [Thu, 13 Apr 2006 18:01:45 +0000 (18:01 +0000)] 
Fix similar_escape() so that SIMILAR TO works properly for patterns involving
alternatives ("|" symbol).  The original coding allowed the added ^ and $
constraints to be absorbed into the first and last alternatives, producing
a pattern that would match more than it should.  Per report from Eric Noriega.

I also changed the pattern to add an ARE director ("***:"), ensuring that
SIMILAR TO patterns do not change behavior if regex_flavor is changed.  This
is necessary to make the non-capturing parentheses work, and seems like a
good idea on general principles.

Back-patched as far as 7.4.  7.3 also has the bug, but a fix seems impractical
because that version's regex engine doesn't have non-capturing parens.

19 years agoDetoast query in g_intbig_consistent and copy query in g_int_consistent.
Teodor Sigaev [Mon, 3 Apr 2006 10:45:28 +0000 (10:45 +0000)] 
Detoast query in g_intbig_consistent and copy query in g_int_consistent.
Minor cleanups.

19 years agoTablespaceCreateDbspace should function normally even on platforms that do not
Tom Lane [Wed, 29 Mar 2006 15:16:00 +0000 (15:16 +0000)] 
TablespaceCreateDbspace should function normally even on platforms that do not
have symlinks (ie, Windows).  Although it'll never be called on to do anything
useful during normal operation on such a platform, it's still needed to
re-create dropped directories during WAL replay.

19 years agoRepair longstanding error in btree xlog replay: XLogReadBuffer should be
Tom Lane [Tue, 28 Mar 2006 21:17:44 +0000 (21:17 +0000)] 
Repair longstanding error in btree xlog replay: XLogReadBuffer should be
passed extend = true whenever we are reading a page we intend to reinitialize
completely, even if we think the page "should exist".  This is because it
might indeed not exist, if the relation got truncated sometime after the
current xlog record was made and before the crash we're trying to recover
from.  These two thinkos appear to explain both of the old bug reports
discussed here:
http://archives.postgresql.org/pgsql-hackers/2005-05/msg01369.php

19 years agoFixed bug 2330: Wrong error code in case of a duplicate key
Michael Meskes [Sun, 19 Mar 2006 12:30:17 +0000 (12:30 +0000)] 
Fixed bug 2330: Wrong error code in case of a duplicate key

19 years agoThe call to DNSServiceRegistrationCreate in postmaster.c does incorrect
Neil Conway [Sat, 18 Mar 2006 22:10:14 +0000 (22:10 +0000)] 
The call to DNSServiceRegistrationCreate in postmaster.c does incorrect
byte-swapping on the port number which causes the call to fail on Intel
Macs.

This patch uses htons() instead of htonl() and fixes this bug.

Ashley Clark

19 years agoFix order of linking of libxslt and libxml2, per Dave Page.
Tom Lane [Fri, 10 Mar 2006 15:40:06 +0000 (15:40 +0000)] 
Fix order of linking of libxslt and libxml2, per Dave Page.

19 years agoCheck for "msys" so it doesn't use 'con' by checking for an evironment
Bruce Momjian [Sun, 5 Mar 2006 05:33:47 +0000 (05:33 +0000)] 
Check for "msys" so it doesn't use 'con' by checking for an evironment
variable.

19 years agoMinor teak.
Tatsuo Ishii [Sat, 4 Mar 2006 12:37:01 +0000 (12:37 +0000)] 
Minor teak.

19 years agoTighten up SJIS byte sequence check. Now we reject invalid SJIS byte
Tatsuo Ishii [Sat, 4 Mar 2006 11:54:02 +0000 (11:54 +0000)] 
Tighten up SJIS byte sequence check. Now we reject invalid SJIS byte
sequence such as "0x95 0x27". Patches from Akio Ishida.

19 years agoUse DEVTTY as 'con' on Win32 as a replacement for /dev/tty.
Bruce Momjian [Sat, 4 Mar 2006 04:31:05 +0000 (04:31 +0000)] 
Use DEVTTY as 'con' on Win32 as a replacement for /dev/tty.

19 years agoAvoid trying to open /dev/tty on Win32. Some Win32 systems have
Bruce Momjian [Fri, 3 Mar 2006 23:54:52 +0000 (23:54 +0000)] 
Avoid trying to open /dev/tty on Win32.  Some Win32 systems have
/dev/tty, but it isn't a device file and doesn't work as expected.

This fixes a known bug where psql does not prompt for a password on some
Win32 systems.

Backpatch to 8.0.X too.

Robert Kinberg

19 years agomake initdb -U username work as advertised; back out bogus patch at rev 1.42
Andrew Dunstan [Fri, 24 Feb 2006 00:54:27 +0000 (00:54 +0000)] 
make initdb -U username work as advertised; back out bogus patch at rev 1.42
and supply real fix for problem it tried to address.

19 years agoFix three Python reference leaks in PLy_traceback(). This would result
Neil Conway [Mon, 20 Feb 2006 20:10:43 +0000 (20:10 +0000)] 
Fix three Python reference leaks in PLy_traceback(). This would result
in leaking memory when invoking a PL/Python procedure that raises an
exception. Unfortunately this still leaks memory, but at least the
largest leak has been plugged.

This patch also fixes a reference counting mistake in PLy_modify_tuple()
for 8.0, 8.1 and HEAD: we don't actually own a reference to `platt', so
we shouldn't Py_DECREF() it.

19 years agoPatch from Marko Kreen:
Neil Conway [Sat, 18 Feb 2006 20:48:56 +0000 (20:48 +0000)] 
Patch from Marko Kreen:

pgcrypto crypt()/md5 and hmac() leak memory when compiled against
OpenSSL as openssl.c digest ->reset will do two DigestInit calls
against a context.  This happened to work with OpenSSL 0.9.6
but not with 0.9.7+.

Reason for the messy code was that I tried to avoid creating
wrapper structure to transport algorithm info and tried to use
OpenSSL context for it.  The fix is to create wrapper structure.

It also uses newer digest API to avoid memory allocations
on reset with newer OpenSSLs.

Thanks to Daniel Blaisdell for reporting it.

19 years agoMove btbulkdelete's vacuum_delay_point() call to a place in the loop where
Tom Lane [Tue, 14 Feb 2006 17:20:17 +0000 (17:20 +0000)] 
Move btbulkdelete's vacuum_delay_point() call to a place in the loop where
we are not holding a buffer content lock; where it was, InterruptHoldoffCount
is positive and so we'd not respond to cancel signals as intended.  Also
add missing vacuum_delay_point() call in btvacuumcleanup.  This should fix
complaint from Evgeny Gridasov about failure to respond to SIGINT/SIGTERM
in a timely fashion (bug #2257).

19 years agoFix qual_is_pushdown_safe to not try to push down quals involving a whole-row
Tom Lane [Mon, 13 Feb 2006 16:22:38 +0000 (16:22 +0000)] 
Fix qual_is_pushdown_safe to not try to push down quals involving a whole-row
Var referencing the subselect output.  While this case could possibly be made
to work, it seems not worth expending effort on.  Per report from Magnus
Naeslund(f).

19 years agoStamp 8.0.7. REL8_0_7
Tom Lane [Sun, 12 Feb 2006 22:38:05 +0000 (22:38 +0000)] 
Stamp 8.0.7.

19 years agoUpdate release notes.
Tom Lane [Sun, 12 Feb 2006 22:35:52 +0000 (22:35 +0000)] 
Update release notes.

19 years agoFix bug in SET SESSION AUTHORIZATION that allows unprivileged users to crash
Tom Lane [Sun, 12 Feb 2006 22:33:14 +0000 (22:33 +0000)] 
Fix bug in SET SESSION AUTHORIZATION that allows unprivileged users to crash
the server, if it has been compiled with Asserts enabled (CVE-2006-0553).
Thanks to Akio Ishida for reporting this problem.

19 years agoUpdate FAQ latest version
Bruce Momjian [Sun, 12 Feb 2006 18:50:45 +0000 (18:50 +0000)] 
Update FAQ latest version

19 years agoStamp releases for 2006-02-14 release
Bruce Momjian [Sun, 12 Feb 2006 18:41:53 +0000 (18:41 +0000)] 
Stamp releases for 2006-02-14 release

19 years agoUpdate release notes for 2006-02-14 release
Bruce Momjian [Sun, 12 Feb 2006 18:23:46 +0000 (18:23 +0000)] 
Update release notes for 2006-02-14 release

19 years agoCheck that SID is enabled while checking for Windows admin privileges.
Tom Lane [Fri, 10 Feb 2006 21:52:43 +0000 (21:52 +0000)] 
Check that SID is enabled while checking for Windows admin privileges.
Magnus

19 years agoChange search for default operator classes so that it examines all opclasses
Tom Lane [Fri, 10 Feb 2006 19:01:33 +0000 (19:01 +0000)] 
Change search for default operator classes so that it examines all opclasses
regardless of the current schema search path.  Since CREATE OPERATOR CLASS
only allows one default opclass per datatype regardless of schemas, this
should have minimal impact, and it fixes problems with failure to find a
desired opclass while restoring dump files.  Per discussion at
http://archives.postgresql.org/pgsql-hackers/2006-02/msg00284.php.
Remove now-redundant-or-unused code in typcache.c and namespace.c,
and backpatch as far as 8.0.

19 years agoProvide the libpq error message when PQputline or PQendcopy fails.
Tom Lane [Thu, 9 Feb 2006 18:28:43 +0000 (18:28 +0000)] 
Provide the libpq error message when PQputline or PQendcopy fails.

19 years agoReject out-of-range dates in date_in().
Tom Lane [Thu, 9 Feb 2006 03:40:42 +0000 (03:40 +0000)] 
Reject out-of-range dates in date_in().

Kris Jurka

19 years agoFix pg_restore to properly discard COPY data when trying to continue
Tom Lane [Sun, 5 Feb 2006 20:59:06 +0000 (20:59 +0000)] 
Fix pg_restore to properly discard COPY data when trying to continue
after an error in a COPY statement.  Formerly it thought the COPY data
was SQL commands, and got quite confused.

Stephen Frost

19 years agoFix const cast in get_progname().
Bruce Momjian [Wed, 1 Feb 2006 12:42:30 +0000 (12:42 +0000)] 
Fix const cast in get_progname().

Backpatch.

19 years agoSet progname early in the postmaster/postgres binary, rather than doing
Bruce Momjian [Wed, 1 Feb 2006 00:47:03 +0000 (00:47 +0000)] 
Set progname early in the postmaster/postgres binary, rather than doing
it later.  This fixes a problem where EXEC_BACKEND didn't have progname
set, causing a segfault if log_min_messages was set below debug2 and our
own snprintf.c was being used.

Also alway strdup() progname.

Backpatch to 8.1.X and 8.0.X.

19 years agoFix ALTER COLUMN TYPE bug: it sometimes tried to drop UNIQUE or PRIMARY KEY
Tom Lane [Mon, 30 Jan 2006 16:19:12 +0000 (16:19 +0000)] 
Fix ALTER COLUMN TYPE bug: it sometimes tried to drop UNIQUE or PRIMARY KEY
constraints before FOREIGN KEY constraints that depended on them.  Originally
reported by Neil Conway on 29-Jun-2005.  Patch by Nakano Yoshihisa.

19 years agoUndo perl's nasty locale setting on Windows. Since we can't do that as
Andrew Dunstan [Sat, 28 Jan 2006 16:22:49 +0000 (16:22 +0000)] 
Undo perl's nasty locale setting on Windows. Since we can't do that as
elsewhere by setting the environment appropriately, we make perl do it
right after interpreter startup by calling its POSIX::setlocale().

19 years agoFix display of whole-row Var appearing at the top level of a SELECT list.
Tom Lane [Thu, 26 Jan 2006 17:08:34 +0000 (17:08 +0000)] 
Fix display of whole-row Var appearing at the top level of a SELECT list.
While we normally prefer the notation "foo.*" for a whole-row Var, that does
not work at SELECT top level, because in that context the parser will assume
that what is wanted is to expand the "*" into a list of separate target
columns, yielding behavior different from a whole-row Var.  We have to emit
just "foo" instead in that context.  Per report from Sokolov Yura.

19 years agoRepair longstanding bug in slru/clog logic: it is possible for two backends
Tom Lane [Sat, 21 Jan 2006 04:38:36 +0000 (04:38 +0000)] 
Repair longstanding bug in slru/clog logic: it is possible for two backends
to try to create a log segment file concurrently, but the code erroneously
specified O_EXCL to open(), resulting in a needless failure.  Before 7.4,
it was even a PANIC condition :-(.  Correct code is actually simpler than
what we had, because we can just say O_CREAT to start with and not need a
second open() call.  I believe this accounts for several recent reports of
hard-to-reproduce "could not create file ...: File exists" errors in both
pg_clog and pg_subtrans.

19 years agoRemove $(DESTDIR) from the pgxs BE_DLLLIBS= -L path for Darwin.
Bruce Momjian [Thu, 19 Jan 2006 21:20:32 +0000 (21:20 +0000)] 
Remove $(DESTDIR) from the pgxs BE_DLLLIBS= -L path for Darwin.

19 years agoRemove $(DESTDIR) from the pgxs BE_DLLLIBS= -L path.
Bruce Momjian [Thu, 19 Jan 2006 20:45:20 +0000 (20:45 +0000)] 
Remove $(DESTDIR) from the pgxs BE_DLLLIBS= -L path.

19 years agoAvoid crashing if relcache flush occurs while trying to load data into an
Tom Lane [Thu, 19 Jan 2006 20:28:57 +0000 (20:28 +0000)] 
Avoid crashing if relcache flush occurs while trying to load data into an
index's support-function cache (in index_getprocinfo).  Since none of that
data can change for an index that's in active use, it seems sufficient to
treat all open indexes the same way we were treating "nailed" system indexes
--- that is, just re-read the pg_class row and leave the rest of the relcache
entry strictly alone.  The pg_class re-read might not be strictly necessary
either, but since the reltablespace and relfilenode can change in normal
operation it seems safest to do it.  (We don't support changing any of the
other info about an index at all, at the moment.)

Back-patch as far as 8.0.  It might be possible to adapt the patch to 7.4,
but it would take more work than I care to expend for such a low-probability
problem.  7.3 is out of luck for sure.

19 years agoFix pgxs -L library path specification for Win32 and Cygwin, was /bin,
Bruce Momjian [Thu, 19 Jan 2006 20:01:32 +0000 (20:01 +0000)] 
Fix pgxs -L library path specification for Win32 and Cygwin, was /bin,
now /lib.

19 years agoIt turns out that TablespaceCreateDbspace fails badly if a relcache flush
Tom Lane [Thu, 19 Jan 2006 04:45:58 +0000 (04:45 +0000)] 
It turns out that TablespaceCreateDbspace fails badly if a relcache flush
occurs when it tries to heap_open pg_tablespace.  When control returns to
smgrcreate, that routine will be holding a dangling pointer to a closed
SMgrRelation, resulting in mayhem.  This is of course a consequence of
the violation of proper module layering inherent in having smgr.c call
a tablespace command routine, but the simplest fix seems to be to change
the locking mechanism.  There's no real need for TablespaceCreateDbspace
to touch pg_tablespace at all --- it's only opening it as a way of locking
against a parallel DROP TABLESPACE command.  A much better answer is to
create a special-purpose LWLock to interlock these two operations.
This drops TablespaceCreateDbspace quite a few layers down the food chain
and makes it something reasonably safe for smgr to call.

19 years agoRepair problems with the result of lookup_rowtype_tupdesc() possibly being
Tom Lane [Tue, 17 Jan 2006 17:33:37 +0000 (17:33 +0000)] 
Repair problems with the result of lookup_rowtype_tupdesc() possibly being
discarded by cache flush while still in use.  This is a minimal patch that
just copies the tupdesc anywhere it could be needed across a flush.  Applied
to back branches only; Neil Conway is working on a better long-term solution
for HEAD.

19 years agoWhen using GCC on AMD64 and PPC, ECPGget_variable() takes a va_list *, not
Neil Conway [Sun, 15 Jan 2006 22:47:21 +0000 (22:47 +0000)] 
When using GCC on AMD64 and PPC, ECPGget_variable() takes a va_list *, not
a va_list. Christof Petig's previous patch made this change, but neglected
to update ecpglib/descriptor.c, resulting in a compiler warning (and a
likely runtime crash) on AMD64 and PPC.

19 years agoFix pg_ctl crash on "unregister" when a data directory is not specified.
Peter Eisentraut [Sat, 14 Jan 2006 16:18:30 +0000 (16:18 +0000)] 
Fix pg_ctl crash on "unregister" when a data directory is not specified.
by Magnus Hagander

19 years agoWe neglected to apply domain constraints on UNKNOWN parameters to
Neil Conway [Thu, 12 Jan 2006 22:29:22 +0000 (22:29 +0000)] 
We neglected to apply domain constraints on UNKNOWN parameters to
prepared statements, per report from David Wheeler.

19 years agoRepair "Halloween problem" in EvalPlanQual: a tuple that's been inserted by
Tom Lane [Thu, 12 Jan 2006 21:49:19 +0000 (21:49 +0000)] 
Repair "Halloween problem" in EvalPlanQual: a tuple that's been inserted by
our own command (or more generally, xmin = our xact and cmin >= current
command ID) should not be seen as good.  Else we may try to update rows
we already updated.  This error was inserted last August while fixing the
even bigger problem that the old coding wouldn't see *any* tuples inserted
by our own transaction as good.  Per report from Euler Taveira de Oliveira.

19 years agoUse a more bulletproof test for whether finite() and isinf() are present.
Tom Lane [Thu, 12 Jan 2006 19:24:02 +0000 (19:24 +0000)] 
Use a more bulletproof test for whether finite() and isinf() are present.
It seems that recent gcc versions can optimize away calls to these functions
even when the functions do not exist on the platform, resulting in a bogus
positive result.  Avoid this by using a non-constant argument and ensuring
that the function result is not simply discarded.  Per report from
François Laupretre.

19 years agoFix pg_tzset() to ensure that 'lclmem' (the static variable holding
Tom Lane [Tue, 10 Jan 2006 20:16:25 +0000 (20:16 +0000)] 
Fix pg_tzset() to ensure that 'lclmem' (the static variable holding
the localtime timezone data) is not overwritten until we know the data
is good.  tzload() is capable of failing after having begun modifying
the struct it's pointed at, and in such cases the static data was left
in a corrupt state.  Bug does not exist pre-8.0 (since we didn't have
this code then) nor post-8.0 (since we already changed the code to
tzload into local variables initially).  Per report from Nick Martens.

19 years agoIn PLy_function_build_args(), the code loops repeatedly, constructing
Neil Conway [Tue, 10 Jan 2006 00:33:48 +0000 (00:33 +0000)] 
In PLy_function_build_args(), the code loops repeatedly, constructing
one argument at a time and then inserting the argument into a Python
list via PyList_SetItem(). This "steals" the reference to the argument:
that is, the reference to the new list member is now held by the Python
list itself. This works fine, except if an elog occurs. This causes the
function's PG_CATCH() block to be invoked, which decrements the
reference counts on both the current argument and the list of arguments.
If the elog happens to occur during the second or subsequent iteration
of the loop, the reference count on the current argument will be
decremented twice.

The fix is simple: set the local pointer to the current argument to NULL
immediately after adding it to the argument list. This ensures that the
Py_XDECREF() in the PG_CATCH() block doesn't double-decrement.

19 years agoFix pg_dump to add the required OPERATOR() decoration to schema-qualified
Tom Lane [Mon, 9 Jan 2006 21:16:37 +0000 (21:16 +0000)] 
Fix pg_dump to add the required OPERATOR() decoration to schema-qualified
operator names.  This is needed when dumping operator definitions that have
COMMUTATOR (or similar) links to operators in other schemas.
Apparently Daniel Whitter is the first person ever to try this :-(

19 years agoStop perl from hijacking stdio and other stuff on Windows.
Andrew Dunstan [Sun, 8 Jan 2006 15:51:19 +0000 (15:51 +0000)] 
Stop perl from hijacking stdio and other stuff on Windows.

19 years agoAdd RelationOpenSmgr() calls to ensure rd_smgr is valid when we try to
Tom Lane [Sat, 7 Jan 2006 22:46:07 +0000 (22:46 +0000)] 
Add RelationOpenSmgr() calls to ensure rd_smgr is valid when we try to
use it.  While it normally has been opened earlier during btree index
build, testing shows that it's possible for the link to be closed again
if an sinval reset occurs while the index is being built.

19 years agoFix failure to apply domain constraints to a NULL constant that's added to
Tom Lane [Fri, 6 Jan 2006 20:11:24 +0000 (20:11 +0000)] 
Fix failure to apply domain constraints to a NULL constant that's added to
an INSERT target list during rule rewriting.  Per report from John Supplee.

19 years agoRelease-note updates and copy editing. REL8_0_6
Tom Lane [Fri, 6 Jan 2006 03:00:20 +0000 (03:00 +0000)] 
Release-note updates and copy editing.

19 years agoFix Windows-only postmaster code to reject a connection request and continue,
Tom Lane [Fri, 6 Jan 2006 02:58:40 +0000 (02:58 +0000)] 
Fix Windows-only postmaster code to reject a connection request and continue,
rather than elog(FATAL), when there is no more room in ShmemBackendArray.
This is a security issue since too many connection requests arriving close
together could cause the postmaster to shut down, resulting in denial of
service.  Reported by Yoshiyuki Asaba, fixed by Magnus Hagander.

19 years agoGenerate back-branch configure scripts with the appropriate version of autoconf.
Tom Lane [Fri, 6 Jan 2006 02:30:52 +0000 (02:30 +0000)] 
Generate back-branch configure scripts with the appropriate version of autoconf.

19 years agoConvert Assert checking for empty page into a regular test and elog.
Tom Lane [Fri, 6 Jan 2006 00:16:09 +0000 (00:16 +0000)] 
Convert Assert checking for empty page into a regular test and elog.
The consequences of overwriting a non-empty page are bad enough that
we should not omit this test in production builds.

19 years agoFix ReadBuffer() to correctly handle the case where it's trying to extend
Tom Lane [Fri, 6 Jan 2006 00:04:33 +0000 (00:04 +0000)] 
Fix ReadBuffer() to correctly handle the case where it's trying to extend
the relation but it finds a pre-existing valid buffer.  The buffer does not
correspond to any page known to the kernel, so we *must* do smgrextend to
ensure that the space becomes allocated.  The 7.x branches all do this
correctly, but the corner case got lost somewhere during 8.0 bufmgr rewrites.
(My fault no doubt :-( ... I think I assumed that such a buffer must be
not-BM_VALID, which is not so.)

19 years agoNew pgcrypto item wording.
Bruce Momjian [Thu, 5 Jan 2006 15:18:29 +0000 (15:18 +0000)] 
New pgcrypto item wording.

19 years agoWording improvements.
Bruce Momjian [Thu, 5 Jan 2006 15:12:03 +0000 (15:12 +0000)] 
Wording improvements.

19 years agoImprove markup.
Bruce Momjian [Thu, 5 Jan 2006 14:53:18 +0000 (14:53 +0000)] 
Improve markup.

19 years agoUpdate release notes.
Bruce Momjian [Thu, 5 Jan 2006 05:23:09 +0000 (05:23 +0000)] 
Update release notes.

19 years agoStamp relesae 8.0.6.
Bruce Momjian [Thu, 5 Jan 2006 04:00:29 +0000 (04:00 +0000)] 
Stamp relesae 8.0.6.

19 years agoArrange to set the LC_XXX environment variables to match our locale setup.
Tom Lane [Thu, 5 Jan 2006 00:55:07 +0000 (00:55 +0000)] 
Arrange to set the LC_XXX environment variables to match our locale setup.
Back-patch of previous fix in HEAD for plperl-vs-locale issue.

19 years agoWhen the remote query result has a different number of columns
Joe Conway [Tue, 3 Jan 2006 23:47:24 +0000 (23:47 +0000)] 
When the remote query result has a different number of columns
than the local query specifies (e.g. in the FROM clause),
throw an ERROR (instead of crashing). Fix for bug #2129 reported
by Akio Iwaasa.

19 years agoThere is a signedness bug in Openwall gen_salt code that pgcrypto uses.
Tom Lane [Tue, 3 Jan 2006 23:46:44 +0000 (23:46 +0000)] 
There is a signedness bug in Openwall gen_salt code that pgcrypto uses.
This makes the salt space for md5 and xdes algorithms a lot smaller than
it should be.

Marko Kreen

19 years agoFix incorrect treatment of RL_PROMPT_START_IGNORE/RL_PROMPT_END_IGNORE,
Tom Lane [Tue, 3 Jan 2006 23:32:40 +0000 (23:32 +0000)] 
Fix incorrect treatment of RL_PROMPT_START_IGNORE/RL_PROMPT_END_IGNORE,
per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=343616 via Martin Pitt.

19 years agoAdd checks to verify that a plpgsql function returning a rowtype is actually
Tom Lane [Tue, 3 Jan 2006 22:48:28 +0000 (22:48 +0000)] 
Add checks to verify that a plpgsql function returning a rowtype is actually
returning the rowtype it's supposed to return.  Per reports from David Niblett
and Michael Fuhr.

19 years agoRemove DOS line endings ("\r\n") from several .po files. DOS line endings
Neil Conway [Sun, 1 Jan 2006 10:14:59 +0000 (10:14 +0000)] 
Remove DOS line endings ("\r\n") from several .po files. DOS line endings
are inconsistent with the rest of the .po files, and apparently cause
problems for Sun's cc. Per report on IRC from "bitvector2".

19 years agoIndex: src/pl/plpython/plpython.c
Neil Conway [Thu, 29 Dec 2005 21:47:49 +0000 (21:47 +0000)] 
Index: src/pl/plpython/plpython.c
===================================================================
RCS file: /Users/neilc/postgres/cvs_root/pgsql/src/pl/plpython/plpython.c,v
retrieving revision 1.67
diff -c -r1.67 plpython.c
*** src/pl/plpython/plpython.c 26 Dec 2005 04:28:48 -0000 1.67
--- src/pl/plpython/plpython.c 29 Dec 2005 16:54:57 -0000
***************
*** 2,8 ****
   * plpython.c - python as a procedural language for PostgreSQL
   *
   * This software is copyright by Andrew Bosma
!  * but is really shameless cribbed from pltcl.c by Jan Weick, and
   * plperl.c by Mark Hollomon.
   *
   * The author hereby grants permission to use, copy, modify,
--- 2,8 ----
   * plpython.c - python as a procedural language for PostgreSQL
   *
   * This software is copyright by Andrew Bosma
!  * but is really shamelessly cribbed from pltcl.c by Jan Wieck, and
   * plperl.c by Mark Hollomon.
   *
   * The author hereby grants permission to use, copy, modify,
***************
*** 1996,2002 ****
   int i,
   rv;
   PLyPlanObject *plan;
-  char    *nulls;
   MemoryContext oldcontext;

   if (list != NULL)
--- 1996,2001 ----
***************
*** 2018,2024 ****
   if (nargs != plan->nargs)
   {
   char    *sv;
-
   PyObject   *so = PyObject_Str(list);

   if (!so)
--- 2017,2022 ----
***************
*** 2036,2048 ****
   oldcontext = CurrentMemoryContext;
   PG_TRY();
   {
!  nulls = palloc(nargs * sizeof(char));

   for (i = 0; i < nargs; i++)
   {
   PyObject   *elem,
      *so;
-  char    *sv;

   elem = PySequence_GetItem(list, i);
   if (elem != Py_None)
--- 2034,2045 ----
   oldcontext = CurrentMemoryContext;
   PG_TRY();
   {
!  char    *nulls = palloc(nargs * sizeof(char));

   for (i = 0; i < nargs; i++)
   {
   PyObject   *elem,
      *so;

   elem = PySequence_GetItem(list, i);
   if (elem != Py_None)
***************
*** 2051,2070 ****
   if (!so)
   PLy_elog(ERROR, "function \"%s\" could not execute plan",
    PLy_procedure_name(PLy_curr_procedure));
!  sv = PyString_AsString(so);

!  /*
!   * FIXME -- if this elogs, we have Python reference leak
!   */
!  plan->values[i] =
!  FunctionCall3(&(plan->args[i].out.d.typfunc),
!    CStringGetDatum(sv),
!  ObjectIdGetDatum(plan->args[i].out.d.typioparam),
!    Int32GetDatum(-1));

!  Py_DECREF(so);
!  Py_DECREF(elem);

   nulls[i] = ' ';
   }
   else
--- 2048,2073 ----
   if (!so)
   PLy_elog(ERROR, "function \"%s\" could not execute plan",
    PLy_procedure_name(PLy_curr_procedure));
!  Py_DECREF(elem);

!  PG_TRY();
!  {
!  char *sv = PyString_AsString(so);

!  plan->values[i] =
!  FunctionCall3(&(plan->args[i].out.d.typfunc),
!    CStringGetDatum(sv),
!  ObjectIdGetDatum(plan->args[i].out.d.typioparam),
!    Int32GetDatum(-1));
!  }
!  PG_CATCH();
!  {
!  Py_DECREF(so);
!  PG_RE_THROW();
!  }
!  PG_END_TRY();

+  Py_DECREF(so);
   nulls[i] = ' ';
   }
   else

19 years agoFix long standing Asian multibyte charsets bug.
Tatsuo Ishii [Sat, 24 Dec 2005 10:11:32 +0000 (10:11 +0000)] 
Fix long standing Asian multibyte charsets bug.
See:

Subject: [HACKERS] bugs with certain Asian multibyte charsets
From: Tatsuo Ishii <ishii@sraoss.co.jp>
To: pgsql-hackers@postgresql.org
Date: Sat, 24 Dec 2005 18:25:33 +0900 (JST)

for more details.

19 years agoFix make_relative_path() to support cases where target_path and bin_path
Tom Lane [Fri, 23 Dec 2005 22:34:33 +0000 (22:34 +0000)] 
Fix make_relative_path() to support cases where target_path and bin_path
differ by more than the last directory component.  Instead of insisting
that they match up to the last component, accept whatever common prefix
they have, and try to replace the non-matching part of bin_path with
the non-matching part of target_path in the actual executable's path.
In one way this is tighter than the old code, because it insists on
a match to the part of bin_path we want to substitute for, rather than
blindly stripping one directory component from the executable's path.
Per gripe from Martin Pitt and subsequent discussion.

19 years agoAdjust string comparison so that only bitwise-equal strings are considered
Tom Lane [Thu, 22 Dec 2005 22:50:14 +0000 (22:50 +0000)] 
Adjust string comparison so that only bitwise-equal strings are considered
equal: if strcoll claims two strings are equal, check it with strcmp, and
sort according to strcmp if not identical.  This fixes inconsistent
behavior under glibc's hu_HU locale, and probably under some other locales
as well.  Also, take advantage of the now-well-defined behavior to speed up
texteq, textne, bpchareq, bpcharne: they may as well just do a bitwise
comparison and not bother with strcoll at all.

NOTE: affected databases may need to REINDEX indexes on text columns to be
sure they are self-consistent.

19 years agoFix word's length in pg_regexec call
Teodor Sigaev [Wed, 21 Dec 2005 13:08:14 +0000 (13:08 +0000)] 
Fix word's length in pg_regexec call

19 years agoDefend against crash while processing Describe Statement or Describe Portal
Tom Lane [Wed, 14 Dec 2005 17:06:51 +0000 (17:06 +0000)] 
Defend against crash while processing Describe Statement or Describe Portal
messages, when client attempts to execute these outside a transaction (start
one) or in a failed transaction (reject message, except for COMMIT/ROLLBACK
statements which we can handle).  Per report from Francisco Figueiredo Jr.

19 years agoFix a *different* problem with whole-row Vars afflicting 8.0 branch.
Tom Lane [Wed, 14 Dec 2005 16:30:20 +0000 (16:30 +0000)] 
Fix a *different* problem with whole-row Vars afflicting 8.0 branch.
This is a back-port of a fix made to markTargetListOrigin() on 2005-04-25.

19 years agoTranslation updates REL8_0_5
Peter Eisentraut [Fri, 9 Dec 2005 22:16:16 +0000 (22:16 +0000)] 
Translation updates

19 years agoStamp 8.0.5.
Tom Lane [Fri, 9 Dec 2005 20:49:38 +0000 (20:49 +0000)] 
Stamp 8.0.5.

19 years agoAdd release notes for back branches (7.3 and up).
Tom Lane [Fri, 9 Dec 2005 20:40:38 +0000 (20:40 +0000)] 
Add release notes for back branches (7.3 and up).
Also minor improvements to 8.1.1 release notes.

19 years agoDocumentation fix: s/event_object_name/event_object_table/g
Peter Eisentraut [Thu, 8 Dec 2005 20:45:26 +0000 (20:45 +0000)] 
Documentation fix: s/event_object_name/event_object_table/g

19 years agoFix bgwriter's failure to release buffer pins and open files after an
Tom Lane [Thu, 8 Dec 2005 19:19:45 +0000 (19:19 +0000)] 
Fix bgwriter's failure to release buffer pins and open files after an
error.  This probably explains bug #2099 and could also account for
mysterious VACUUM hangups.

19 years agoFix stupid bug with sizeof
Teodor Sigaev [Tue, 6 Dec 2005 18:22:21 +0000 (18:22 +0000)] 
Fix stupid bug with sizeof

19 years agoIn a nestloop inner indexscan, it's OK to use pushed-down baserestrictinfo
Tom Lane [Tue, 6 Dec 2005 16:50:55 +0000 (16:50 +0000)] 
In a nestloop inner indexscan, it's OK to use pushed-down baserestrictinfo
clauses even if it's an outer join.  This is a corner case since such
clauses could only arise from weird OUTER JOIN ON conditions, but worth
fixing.  Per example from Ron at cheapcomplexdevices.com.

19 years agoAdd regression test to see if the min/max values of int8 convert correctly.
Tom Lane [Mon, 5 Dec 2005 04:14:07 +0000 (04:14 +0000)] 
Add regression test to see if the min/max values of int8 convert correctly.

19 years agoFix out-of-order inclusion of -L switches from LDFLAGS on AIX and HPUX.
Tom Lane [Sat, 3 Dec 2005 20:16:50 +0000 (20:16 +0000)] 
Fix out-of-order inclusion of -L switches from LDFLAGS on AIX and HPUX.
Per example from Dirk Pirschel.

19 years agoFix obsolete description of -h option, per Andreas Schmidt.
Tom Lane [Fri, 2 Dec 2005 23:14:02 +0000 (23:14 +0000)] 
Fix obsolete description of -h option, per Andreas Schmidt.

19 years agoRetry in FileRead and FileWrite if Windows returns ERROR_NO_SYSTEM_RESOURCES.
Tom Lane [Thu, 1 Dec 2005 20:24:49 +0000 (20:24 +0000)] 
Retry in FileRead and FileWrite if Windows returns ERROR_NO_SYSTEM_RESOURCES.
Also add a retry for Unixen returning EINTR, which hasn't been reported
as an issue but at least theoretically could be.  Patch by Qingqing Zhou,
some minor adjustments by me.