1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-31 03:21:24 +03:00

21777 Commits

Author SHA1 Message Date
Bruce Momjian
cc6dbbeefc Fix for recent Win32 pg_dump tar temp file patch.
Hiroshi Saito
2006-06-27 02:56:46 +00:00
Bruce Momjian
837a7df8dd On Win32, use loop to create pg_dump temporary tar file in the current
directory, not in device root, for permission reasons.

Backpatch to 8.1.X.
2006-06-27 01:17:05 +00:00
Michael Meskes
88f396e1cb Added missing braces to prevent a segfault after usage of an undeclared cursor. 2006-06-26 14:12:42 +00:00
Michael Meskes
1bdea12e5c Added some more coverity report patches send in by Joachim Wieland <joe@mcknight.de>. 2006-06-26 09:20:19 +00:00
Tom Lane
1f9acaf21d Tweak dynahash.c to avoid wasting memory space in non-shared hash tables.
palloc() will normally round allocation requests up to the next power of 2,
so make dynahash choose allocation sizes that are as close to a power of 2
as possible.
Back-patch to 8.1 --- the problem exists further back, but a much larger
patch would be needed and it doesn't seem worth taking any risks.
2006-06-25 18:29:56 +00:00
Michael Meskes
5ececcbbf5 Moved some free() calls that coverity correctly complains about. 2006-06-25 09:59:18 +00:00
Alvaro Herrera
15af8b771b 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:00 +00:00
Tom Lane
1c718dd8bf pg_stop_backup was calling XLogArchiveNotify() twice for the newly created
backup history file.  Bug introduced by the 8.1 change to make pg_stop_backup
delete older history files.  Per report from Masao Fujii.
2006-06-22 20:43:20 +00:00
Tom Lane
62ae14545b Disallow aggregate functions in UPDATE commands (unless within a sub-SELECT).
This is disallowed by the SQL spec because it doesn't have any very sensible
interpretation.  Historically Postgres has allowed it but behaved strangely.
As of PG 8.1 a server crash is possible if the MIN/MAX index optimization gets
applied; rather than try to "fix" that, it seems best to just enforce the
spec restriction.  Per report from Josh Drake and Alvaro Herrera.
2006-06-21 18:30:19 +00:00
Joe Conway
e582d2ee1a - During dblink_open, if transaction state was IDLE, force cursor count to
initially be 0. This is needed as a previous ABORT might have wiped out
  an automatically opened transaction without maintaining the cursor count.
- Fix regression test expected file for the correct ERROR message, which
  we now get given the above bug fix.
2006-06-21 16:43:46 +00:00
Michael Meskes
ca1d26338b Added some more coverity report patches send in by Martijn van Oosterhout <kleptog@svana.org>. 2006-06-21 11:38:26 +00:00
Michael Meskes
08f1973911 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:29:50 +00:00
Michael Meskes
23623f05f0 Do not use already free'ed errmsg, bug found by Joachim Wieland
<joachim.wieland@credativ.de>
2006-06-19 09:20:07 +00:00
Tom Lane
63b103aac8 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:32 +00:00
Andrew Dunstan
b243d39456 backport workaround for OpenBSD compiler bug 2006-06-17 14:49:02 +00:00
Tom Lane
33e125cc0b Clean up after someone's curious idea that it'd be good to strip
leading zeroes from the SQLSTATE codes.  They're strings, people,
not numbers.
2006-06-16 22:41:50 +00:00
Bruce Momjian
f44391b0a0 Document issues with non-default tablespaces and pg_dumpall restores.
Backpatch documentation addition to 8.1.X.
2006-06-16 22:01:22 +00:00
Bruce Momjian
4cfe1fadad Avoid use of C commment inside C comment from recent Win32 int overflow patch. 2006-06-12 16:29:08 +00:00
Bruce Momjian
f7a0b645f5 Win32 can't catch the exception thrown by INT_MIN / -1 or INT_MIN * -1,
so on that platform we test for those before the computation and throw
an "out of range" error.

Backpatch to 8.1.X.
2006-06-12 16:09:39 +00:00
Tom Lane
b45f5bb726 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:36 +00:00
Tom Lane
98365a1e34 Repair remarkably-inefficient query for dumping large object comments: it
was invoking obj_description() for each large object chunk, instead of once
per large object.  This code is new as of 8.1, which may explain why the
problem hadn't been noticed already.
2006-06-09 19:46:17 +00:00
Tom Lane
03c1be0663 Fix bootstrap.c so that database startup process and bgwriter properly release
LWLocks during a panic exit.  This avoids the possible self-deadlock pointed
out by Qingqing Zhou.  Also, I noted that an error during LoadFreeSpaceMap()
or BuildFlatFiles() would result in exit(0) which would leave the postmaster
thinking all is well.  Added a critical section to ensure such errors don't
allow startup to proceed.

Backpatched to 8.1.  The 8.0 code is a bit different and I'm not sure if the
problem exists there; given we've not seen this reported from the field, I'm
going to be conservative about backpatching any further.
2006-06-08 23:55:54 +00:00
Tom Lane
735529ce24 Remove "fuzzy comparison" logic in qsort comparison function for
choose_bitmap_and().  It was way too fuzzy --- per comment, it was meant to be
1% relative difference, but was actually coded as 0.01 absolute difference,
thus causing selectivities of say 0.001 and 0.000000000001 to be treated as
equal.  I believe this thinko explains Maxim Boguk's recent complaint.  While
we could change it to a relative test coded like compare_fuzzy_path_costs(),
there's a bigger problem here, which is that any fuzziness at all renders the
comparison function non-transitive, which could confuse qsort() to the point
of delivering completely wrong results.  So forget the whole thing and just
do an exact comparison.
2006-06-07 17:08:15 +00:00
Bruce Momjian
c944851a79 Backpatch comment about --sysconfdir. 2006-06-07 12:19:37 +00:00
Bruce Momjian
87632c1b8e On Win32, return original patch if GetShortPathName() fails (no short
name, path does not exist), rather than returning nothing.

Backpatch to 8.1.X.
2006-06-06 22:32:56 +00:00
Bruce Momjian
06a1807e5e Have BCC echo output "" using "", rather than \"\" as earlier reported.
Backpatch to 8.1.X.
2006-06-06 16:17:31 +00:00
Michael Meskes
aac12de9b6 Fixed two memory leaks in ecpglib. 2006-06-06 11:36:22 +00:00
Tom Lane
b58ed707ce 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:15 +00:00
Tom Lane
7788c43152 PostmasterIsAlive test really ought to be in the inner loop for safety. 2006-05-30 17:08:20 +00:00
Tom Lane
53409f1b37 Remove pqsignalinquire(), which is unused and has portability issues. 2006-05-30 15:58:07 +00:00
Tom Lane
627f25bde3 Update ppport.h to not cause warnings with newest Perl versions.
This is just the minimal necessary change; we might want to adopt
later PPPort output instead.
2006-05-30 15:48:30 +00:00
Bruce Momjian
e82435a96c Move conversion dependency patch to the proper branch, out of 8.1.X,
into HEAD.
2006-05-30 13:36:40 +00:00
Bruce Momjian
7bec90969f Prevent multiple archivers from starting. Backpatch to 8.1.X.
Simon Riggs
2006-05-30 13:31:01 +00:00
Bruce Momjian
f671bee9d0 Re-defines SHA2 symbols so that they would not conflict with certain
versions of OpenSSL.  If your OpenSSL does not contain SHA2, then there
should be no conflict.  But ofcourse, if someone upgrades OpenSSL,
server starts crashing.

Backpatched to 8.1.X.

Marko Kreen
2006-05-30 12:56:56 +00:00
Bruce Momjian
d30da732da Add "inline" compile fix for MSVC/BCC:
#define inline __inline

Backpatch to 8.1.X.

Hiroshi Saito
2006-05-30 12:43:32 +00:00
Bruce Momjian
401ffe0555 Backpatch documentation additions for PL language choice and
regex_replace() to 8.1.X.
2006-05-30 12:32:37 +00:00
Tom Lane
b71b22d901 Fix initdb to properly escape quotes and backslashes in the supplied
superuser password, and also in the paths of the various files it issues
SQL COPY commands for.  Per bug #2424.
2006-05-27 18:07:22 +00:00
Tom Lane
cad1ff1037 Fix pg_restore to process BLOB COMMENT entries correctly; they aren't
really tables and shouldn't get DISABLE TRIGGER processing.  Per bug
#2452 from Robert Treat.
2006-05-24 21:20:24 +00:00
Bruce Momjian
8a507aeaeb Rename in release notes: Mac -> OS/X, Intel to x86:
Fix for OS/X Bonjour on x86 systems (Ashley Clark)
2006-05-23 20:22:02 +00:00
Tom Lane
313a720f95 Stamp release 8.1.4. REL8_1_4 2006-05-21 21:52:58 +00:00
Tom Lane
3f6b5e21c8 Update release notes for upcoming releases. 2006-05-21 21:49:38 +00:00
Tom Lane
dd2a4ce6ac Fix errors in fortuna PRNG reseeding logic that could cause a predictable
session key to be selected by pgp_sym_encrypt() in some cases.  This only
affects non-OpenSSL-using builds.  Marko Kreen
2006-05-21 20:22:23 +00:00
Tom Lane
7f615cab57 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:19:44 +00:00
Tom Lane
3d4dc1acf5 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:02 +00:00
Tom Lane
8fe643b41b 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:05:50 +00:00
Alvaro Herrera
e5ab52b273 Have autovacuum report its activities to the stat collector. 2006-05-19 15:15:38 +00:00
Bruce Momjian
3a3622c5f0 Back out \' change for tsearch2, broke regression tests. 2006-05-19 04:41:06 +00:00
Bruce Momjian
e720382441 Stamp 8.1.4, except configure/configure.in. 2006-05-19 03:57:17 +00:00
Bruce Momjian
289f10c809 Update release notes for 8.1.4. 2006-05-19 03:50:07 +00:00
Bruce Momjian
95d8b6a7b4 Backpatch FAQs to 8.1.X. 2006-05-19 03:34:49 +00:00