Commit Graph

19938 Commits

Author SHA1 Message Date
Bruce Momjian
b07bda6312 Update release notes for releases 7.3.16, 7.4.14, 8.0.9, and 8.1.5. 2006-10-09 23:23:29 +00:00
Tom Lane
3d32b17798 Fix back-branch pg_regress scripts to try the "canonical" expected file if we
tried a variant file from resultmap and it didn't match.  This is already done
in HEAD's C-code version, and is needed because OpenBSD has recently migrated
to a more standard handling of float underflow --- see buildfarm results
from emu.
2006-10-09 01:45:49 +00:00
Tom Lane
5361743826 Fix ancient oversight in psql's \d pattern processing code: when seeing two
quote chars inside quote marks, should emit one quote *and stay in inquotes
mode*.  No doubt the lack of reports of this have something to do with the
poor documentation of the feature ...
2006-10-07 22:21:50 +00:00
Tom Lane
704f8ea11c Fix string_to_array() to correctly handle the case where there are
overlapping possible matches for the separator string, such as
string_to_array('123xx456xxx789', 'xx').
Also, revise the logic of replace(), split_part(), and string_to_array()
to avoid O(N^2) work from redundant searches and conversions to pg_wchar
format when there are N matches to the separator string.
Backpatched the full patch as far as 8.0.  7.4 also has the bug, but the
code has diverged a lot, so I just went for a quick-and-dirty fix of the
bug itself in that branch.
2006-10-07 00:12:05 +00:00
Tom Lane
d2cc024be1 Fix SysCacheGetAttr() to handle the case where the specified syscache has not
been initialized yet.  This can happen because there are code paths that call
SysCacheGetAttr() on a tuple originally fetched from a different syscache
(hopefully on the same catalog) than the one specified in the call.  It
doesn't seem useful or robust to try to prevent that from happening, so just
improve the function to cope instead.  Per bug#2678 from Jeff Trout.  The
specific example shown by Jeff is new in 8.1, but to be on the safe side
I'm backpatching 8.0 as well.  We could patch 7.x similarly but I think
that's probably overkill, given the lack of evidence of old bugs of this ilk.
2006-10-06 18:23:48 +00:00
Tom Lane
4d3760f674 date_trunc also accepts 'quarter'. Noted by Yoshihisa Nakano. 2006-10-01 18:54:48 +00:00
Tom Lane
220db233f8 Clean up rather sloppy fix in HEAD for the ancient bug that CREATE CONVERSION
didn't create a dependency from the new conversion to its schema.  Back-patch
to all supported releases.
2006-08-31 17:31:48 +00:00
Teodor Sigaev
b0e56b9c0d Fix mistyping 2006-08-29 15:49:00 +00:00
Andrew Dunstan
1aaecd41a6 Add installcheck-parallel target to top level makefiles. 2006-08-18 19:59:05 +00:00
Michael Meskes
2d280ef3fb Backported buffer overrun fix from HEAD 2006-08-18 16:33:50 +00:00
Michael Meskes
95a5a29845 Applied the connect patch from HEAD 2006-08-18 16:00:49 +00:00
Teodor Sigaev
09e33d1628 Fix bug introduced by last patch, thanks again to Mario Weilguni <mweilguni@sime.com> 2006-08-08 15:45:56 +00:00
Tom Lane
01c74da47e Back-port HEAD's configure fixes to select appropriate compiler switches
for Intel's icc and AIX's xlc.
2006-08-07 20:08:57 +00:00
Teodor Sigaev
9a7788fb4d fix bug about modifying value in shared buffer,
what was a reason to corrupt index.
Thank to Mario Weilguni <mweilguni@sime.com> to
discover a bug.
2006-08-07 17:40:53 +00:00
Alvaro Herrera
632db651cb Fix confusion between COPY FROM and COPY TO, per Gavin Sharry and Arul Shaji. 2006-07-31 01:09:48 +00:00
Andrew Dunstan
c33b809765 prevent multiplexing Windows kernel event objects we listen for across various sockets - should fix the occasional stats test regression failures we see. 2006-07-29 20:14:40 +00:00
Tom Lane
96c5389342 Ensure that we retry rather than erroring out when send() or recv() return
EINTR; the stats code was failing to do this and so were a couple of places
in the postmaster.  The stats code assumed that recv() could not return EINTR
if a preceding select() showed the socket to be read-ready, but this is
demonstrably false with our Windows implementation of recv(), and it may
not be the case on all Unix variants either.  I think this explains the
intermittent stats regression test failures we've been seeing, as well
as reports of stats collector instability under high load on Windows.

Backpatch as far as 8.0.
2006-07-16 18:17:35 +00:00
Tom Lane
9f167f564c Add dependency to fix parallel-make race condition. Alexander Dupuy 2006-07-14 16:45:55 +00:00
Teodor Sigaev
7284c36ae7 Fix bug corrupting query in gist consistent function.
Thank to Mario Weilguni <mweilguni@sime.com> to discover a bug.
2006-07-11 16:06:40 +00:00
Tom Lane
6e37be02e7 Fix ALTER TABLE to check pre-existing NOT NULL constraints when rewriting
a table.  Otherwise a USING clause that yields NULL can leave the table
violating its constraint (possibly there are other cases too).  Per report
from Alexander Pravking.
2006-07-10 22:10:57 +00:00
Bruce Momjian
acf40f39be Fix dbmirror for new backslash escaping:
Martin Pitt [2006-06-16  0:15 +0200]:
> Upstream confirmed my reply in the last mail in [1]: the complete
> escaping logic in DBMirror.pl is seriously screwew.
>
> [1] http://archives.postgresql.org/pgsql-bugs/2006-06/msg00065.php

I finally found some time to debug this, and I think I found a better
patch than the one you proposed. Mine is still hackish and is still a
workaround around a proper quoting solution, but at least it repairs
the parsing without introducing the \' quoting again.

I consider this a band-aid patch to fix the recent security update.
PostgreSQL gurus, would you consider applying this until a better
solution is found for DBMirror.pl?

Martin Pitt        http://www.piware.de
2006-07-06 02:03:00 +00:00
Michael Meskes
33215c2b78 Fixed remaining Coverity bugs. 2006-07-05 10:50:20 +00:00
Michael Meskes
b48aeb5145 Added missing braces to prevent a segfault after usage of an undeclared cursor. 2006-06-26 14:13:04 +00:00
Michael Meskes
a503fd3634 Added some more coverity report patches send in by Joachim Wieland <joe@mcknight.de>. 2006-06-26 09:20:30 +00:00
Michael Meskes
b4595d71f2 Moved some free() calls that coverity correctly complains about. 2006-06-25 10:00:11 +00:00
Alvaro Herrera
bd7f34ba78 Our version of getopt_long does not set optarg upon detecting an error, as
opposed to what other versions apparently do, so it's not safe to print an
error message.  Besides, getopt_long itself already did, so it's redundant
anyway.
2006-06-25 04:38:08 +00:00
Michael Meskes
ca6667fef0 Added some more coverity report patches send in by Martijn van Oosterhout <kleptog@svana.org>. 2006-06-21 11:38:35 +00:00
Michael Meskes
289a3b73e2 Added fixes from the coverity report send in by Joachim Wieland <joe@mcknight.de>
Added missing error handling in a few functions in ecpglib.
2006-06-21 10:31:45 +00:00
Tom Lane
49f1f24450 Back-port shell script syntax fix needed for some BSD machines.
Per buildfarm results from spoonbill.
2006-06-19 14:25:01 +00:00
Michael Meskes
14f52896b8 Do not use already free'ed errmsg, bug found by Joachim Wieland
<joachim.wieland@credativ.de>
2006-06-19 09:20:22 +00:00
Tom Lane
605cb39576 Increase timeout in statement_timeout test from 1 second to 2 seconds.
We have once or twice seen failures suggesting that control didn't get
to the exception block before the timeout elapsed, which is unlikely
but not impossible in a parallel regression test (with a dozen other
backends competing for cycles).  This change doesn't completely prevent
the problem of course, but it should reduce the probability enough that
we don't see it anymore.  Per buildfarm results.
2006-06-18 16:21:40 +00:00
Andrew Dunstan
34fe15672d backport workaround for OpenBSD compiler bug 2006-06-17 14:50:44 +00:00
Tom Lane
e2d201ecdb Fix Assert failure when a fastpath function call is attempted inside an
already-aborted transaction block.  GetSnapshotData throws an Assert if
not in a valid transaction; hence we mustn't attempt to set a snapshot
for the function until after checking for aborted transaction.  This is
harmless AFAICT if Asserts aren't enabled (GetSnapshotData will compute
a bogus snapshot, but it doesn't matter since HandleFunctionRequest will
throw an error shortly anywy).  Hence, not a major bug.

Along the way, add some ability to log fastpath calls when statement
logging is turned on.  This could probably stand to be improved further,
but not logging anything is clearly undesirable.

Backpatched as far as 8.0; bug doesn't exist before that.
2006-06-11 15:49:46 +00:00
Michael Meskes
3066e8ab03 Fixed two memory leaks in ecpglib. 2006-06-06 11:36:12 +00:00
Tom Lane
b734fc67a9 Fix copy-and-pasteo in Russian translation: message complaining about
HAVE_INT64_TIMESTAMP was mentioning PG_CONTROL_VERSION instead.
Victor Snezhko
2006-06-03 16:49:32 +00:00
Tom Lane
9b3d3e9baf Back-port recent ppport.h fix to 8.0 branch. 2006-06-01 03:47:34 +00:00
Tom Lane
1252a6a042 Remove pqsignalinquire(), which is unused and has portability issues. 2006-05-30 15:58:14 +00:00
Tom Lane
f966dccb2f Klugy fix for bug #2447: we can't expand a whole-row reference to NEW
in a rule WHERE expression while inserting it into the original query,
because the 8.0 ResolveNew API is wrongly designed.  This is fixed in 8.1
but I'm disinclined to risk back-porting the changes.  Instead, just stop
the coredump and instead issue the same 'cannot handle whole-row reference'
message that 7.4 and before generated in this situation.
2006-05-23 17:09:18 +00:00
Tom Lane
f39fc4769e Stamp release 8.0.8. 2006-05-21 21:53:31 +00:00
Tom Lane
e35c0aee33 Update release notes for upcoming releases. 2006-05-21 21:49:50 +00:00
Tom Lane
6450cee473 Fix missed \' to '' conversion. 2006-05-21 21:13:50 +00:00
Bruce Momjian
29dd673a94 Stamp releases 7.3.15, 7.4.13, and 8.0.8. 2006-05-21 20:28:35 +00:00
Tom Lane
94dec9114b 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.
2006-05-21 20:20:05 +00:00
Tom Lane
9bc62ddd5f 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.
2006-05-21 20:11:25 +00:00
Tom Lane
70794254a1 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.
2006-05-21 20:06:18 +00:00
Bruce Momjian
833e84621c Change \' to '', for SQL standards compliance. Backpatch to 7.3, 7.4,
and 8.0.  Later releases already patched.
2006-05-21 19:57:40 +00:00
Tom Lane
a2e7036909 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.
2006-05-19 16:30:50 +00:00
Tom Lane
f939bdcafe 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.
2006-05-12 22:44:50 +00:00
Tom Lane
e9c56ce5e9 Remove unnecessary .seg/.section directives, per Alan Stange. 2006-05-11 21:58:37 +00:00
Bruce Momjian
47d82d2856 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.
2006-05-08 02:18:21 +00:00