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

21856 Commits

Author SHA1 Message Date
Tom Lane
c4950aa1ee Fix 1-byte buffer overrun when OID exceeds 1 billion. This probably can't
cause any serious harm in normal cases, but if you have gcc buffer overrun
checking turned on, that will notice.  Found by Jack Orenstein.  Problem
was already fixed in CVS HEAD.
2006-11-22 21:12:57 +00:00
Tom Lane
504d87c7cd When truncating a relation in-place (eg during VACUUM), do not try to unlink
any no-longer-needed segments; just truncate them to zero bytes and leave
the files in place for possible future re-use.  This avoids problems when
the segments are re-used due to relation growth shortly after truncation.
Before, the bgwriter, and possibly other backends, could still be holding
open file references to the old segment files, and would write dirty blocks
into those files where they'd disappear from the view of other processes.

Back-patch as far as 8.0.  I believe the 7.x branches are not vulnerable,
because they had no bgwriter, and "blind" writes by other backends would
always be done via freshly-opened file references.
2006-11-20 01:08:02 +00:00
Tom Lane
dfb25d2863 Repair problems with hash indexes that span multiple segments: the hash code's
preference for filling pages out-of-order tends to confuse the sanity checks
in md.c, as per report from Balazs Nagy in bug #2737.  The fix is to ensure
that the smgr-level code always has the same idea of the logical EOF as the
hash index code does, by using ReadBuffer(P_NEW) where we are adding a single
page to the end of the index, and using smgrextend() to reserve a large batch
of pages when creating a new splitpoint.  The patch is a bit ugly because it
avoids making any changes in md.c, which seems the most prudent approach for a
backpatchable beta-period fix.  After 8.3 development opens, I'll take a look
at a cleaner but more invasive patch, in particular getting rid of the now
unnecessary hack to allow reading beyond EOF in mdread().

Backpatch as far as 7.4.  The bug likely exists in 7.3 as well, but because
of the magnitude of the 7.3-to-7.4 changes in hash, the later-version patch
doesn't even begin to apply.  Given the other known bugs in the 7.3-era hash
code, it does not seem worth trying to develop a separate patch for 7.3.
2006-11-19 21:33:29 +00:00
Tom Lane
91eb4895bb Repair two related errors in heap_lock_tuple: it was failing to recognize
cases where we already hold the desired lock "indirectly", either via
membership in a MultiXact or because the lock was originally taken by a
different subtransaction of the current transaction.  These cases must be
accounted for to avoid needless deadlocks and/or inappropriate replacement of
an exclusive lock with a shared lock.  Per report from Clarence Gardner and
subsequent investigation.
2006-11-17 18:00:25 +00:00
Michael Meskes
a2281c8e6f Applied patch by Peter Harris to free auto_mem struct in ECPGconnect. 2006-11-08 10:48:27 +00:00
Tom Lane
b3234f2912 Repair bug #2694 concerning an ARRAY[] construct whose inputs are empty
sub-arrays.  Per discussion, if all inputs are empty arrays then result
must be an empty array too, whereas a mix of empty and nonempty arrays
should (and already did) draw an error.  In the back branches, the
construct was strict: any NULL input immediately yielded a NULL output;
so I left that behavior alone.  HEAD was simply ignoring NULL sub-arrays,
which doesn't seem very sensible.  For lack of a better idea it now
treats NULL sub-arrays the same as empty ones.
2006-11-06 18:21:38 +00:00
Tom Lane
befd4e4e48 Fix recently-identified PITR recovery hazard: the base backup could contain
stale relcache init files (pg_internal.init), and there is no mechanism for
updating them during WAL replay.  Easiest solution is just to delete the init
files at conclusion of startup, and let the first backend started in each
database take care of rebuilding the init file.  Simon Riggs and Tom Lane.

Back-patched to 8.1.  Arguably this should be fixed in 8.0 too, but it would
require significantly more code since 8.0 has no handy startup-time scan of
pg_database to piggyback on.  Manual solution of the problem is possible
in 8.0 (just delete the pg_internal.init files before starting WAL replay),
so that may be a sufficient answer.
2006-11-05 23:40:38 +00:00
Tom Lane
23092b9928 Correct documentation error: in 8.1 and 8.2, %p in archive and restore
command strings inserts relative not absolute path of file to process.
This is a side-effect of 2005-07-04 change that makes the server use
relative paths in general.  Noted by Bernd Helmle.
2006-11-04 18:20:40 +00:00
Tom Lane
6f48f84874 Fix "failed to re-find parent key" btree VACUUM failure by tweaking
_bt_pagedel to recover from the failure: just search the whole parent level
if searching to the right fails.  This does nothing for the underlying problem
that index keys became out-of-order in the grandparent level.  However, we
believe that there is no other consequence worse than slightly inefficient
searching, so this narrow patch seems like the safest solution for the back
branches.
2006-11-01 19:50:03 +00:00
Tom Lane
ecaa7ebed8 pg_restore failed on tar-format archives if they contained large objects
(blobs) with comments, per bug #2727 from Konstantin Pelepelin.
Mea culpa for not having tested this case.
Back-patch to 8.1; prior branches don't dump blob comments at all.
2006-11-01 15:59:31 +00:00
Tom Lane
8a6ed093b4 Back-patch second version of AIX getaddrinfo fix. 2006-10-20 01:10:28 +00:00
Tom Lane
62fc3b9929 Work around reported problem that AIX's getaddrinfo() doesn't seem to zero
sin_port in the returned IP address struct when servname is NULL.  This has
been observed to cause failure to bind the stats collection socket, and
could perhaps cause other issues too.  Per reports from Brad Nicholson
and Chris Browne.
2006-10-19 17:26:37 +00:00
Bruce Momjian
09b98773ab Update Japanese FAQ.
Jun Kuwamura
2006-10-13 17:30:13 +00:00
Tom Lane
91ddf5b548 Fix typo in version number. 2006-10-13 15:25:09 +00:00
Teodor Sigaev
9f1b531420 Fix infinite sleep and failes of send in Win32.
1) pgwin32_waitforsinglesocket(): WaitForMultipleObjectsEx now called with
finite timeout (100ms) in case of FP_WRITE and UDP socket. If timeout occurs
then pgwin32_waitforsinglesocket() tries to write empty packet goes to
WaitForMultipleObjectsEx again.

2) pgwin32_send(): add loop around WSASend and pgwin32_waitforsinglesocket().
The reason is: for overlapped socket, 'ok' result from
pgwin32_waitforsinglesocket() isn't guarantee that socket is still free,
it can become busy again and following WSASend call will fail with
WSAEWOULDBLOCK error.

See http://archives.postgresql.org/pgsql-hackers/2006-10/msg00561.php
2006-10-13 14:00:17 +00:00
Tom Lane
87d57b6c93 Stamp 8.1.5. REL8_1_5 2006-10-12 19:41:27 +00:00
Tom Lane
424157a803 Sync 8.1 pg_config.h.in with expected autoheader output (looks like
someone did this manually last time ...)
2006-10-12 19:29:30 +00:00
Tom Lane
9d457ea802 Update release notes for SQL functions vs triggers fix. 2006-10-12 19:25:22 +00:00
Tom Lane
fb27f43123 Fix mishandling of after-trigger state when a SQL function returns multiple
rows --- if the surrounding query queued any trigger events between the rows,
the events would be fired at the wrong time, leading to bizarre behavior.
Per report from Merlin Moncure.

This is a simple patch that should solve the problem fully in the back
branches, but in HEAD we also need to consider the possibility of queries
with RETURNING clauses.  Will look into a fix for that separately.
2006-10-12 17:02:28 +00:00
Tom Lane
23c64e18ec A bit of copy-editing on back-branch release notes. 2006-10-11 20:56:01 +00:00
Tom Lane
c2caa7b736 Repair incorrect check for coercion of unknown literal to ANYARRAY, a bug
I introduced in 7.4.1 :-(.  It's correct to allow unknown to be coerced to
ANY or ANYELEMENT, since it's a real-enough data type, but it most certainly
isn't an array datatype.  This can cause a backend crash but AFAICT is not
exploitable as a security hole.  Per report from Michael Fuhr.

Note: as fixed in HEAD, this changes a constant in the pg_stats view,
resulting in a change in the expected regression outputs.  The back-branch
patches have been hacked to avoid that, so that pre-existing installations
won't start failing their regression tests.
2006-10-11 20:21:11 +00:00
Tom Lane
97fc0f6e83 CREATE TABLE ... LIKE ... should mark the columns it creates with
attislocal = true, since they are not really inherited but merely copied
from the original table.  I'm not sure if there are any cases where it makes
a real difference given the existing uses of the flag, but wrong is wrong.
This was fixed in passing in HEAD by the LIKE INCLUDING CONSTRAINTS patch,
but never back-patched.
2006-10-11 20:03:11 +00:00
Bruce Momjian
34cd09fdd0 Restore HPUX FAQ entry that talked about working around regression
script problems, because in 8.1.X, the regression test is still a
script.  Patch to 8.1.X only.
2006-10-10 20:11:44 +00:00
Tom Lane
9c2b6ec695 Fix psql \d commands to behave properly when a pattern using regex | is given.
Formerly they'd emit '^foo|bar$' which is wrong because the anchors are
parsed as part of the alternatives; must emit '^(foo|bar)$' to get expected
behavior.  Same as bug found previously in similar_escape().  Already fixed
in HEAD, this is just back-porting the part of that patch that was a bug fix.
2006-10-10 16:15:22 +00:00
Bruce Momjian
61c91fd2d2 Backpatch FAQs to 8.1.X. 2006-10-10 00:29:15 +00:00
Bruce Momjian
7cec8b4e4a Stamp releases 7.3.16, 7.4.14, 8.0.9, and 8.1.5. 2006-10-09 23:39:03 +00:00
Bruce Momjian
5c13747ac9 Update release notes for releases 7.3.16, 7.4.14, 8.0.9, and 8.1.5. 2006-10-09 23:24:06 +00:00
Tom Lane
b7edacccbe 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:41 +00:00
Tom Lane
e407ca3a7b 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:44 +00:00
Tom Lane
a5d892b1c9 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:11:59 +00:00
Tom Lane
a222a158b0 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:41 +00:00
Tom Lane
4af74cc007 date_trunc also accepts 'quarter'. Noted by Yoshihisa Nakano. 2006-10-01 18:54:40 +00:00
Tom Lane
9acbb81dd7 Fix overly enthusiastic Assert introduced in 8.1: it's expecting a
CaseTestExpr, but forgot that the optimizer is sometimes able to replace
CaseTestExpr by Const.
2006-10-01 17:23:51 +00:00
Bruce Momjian
e73687f2ec Backpatch to 8.1.X fix for to_timestamp() where "PM/AM" specification
was eating too much user input, producing incorrect results.
2006-09-04 19:29:18 +00:00
Tom Lane
1e64862ab3 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:40 +00:00
Teodor Sigaev
780451b43d Fix mistyping 2006-08-29 15:48:30 +00:00
Teodor Sigaev
60a25e6f6f Add description of tsvector type layout 2006-08-29 13:57:11 +00:00
Teodor Sigaev
3538b740f3 Remove pos comparison in silly_cmp_tsvector(): it is not a semantically significant 2006-08-29 13:40:11 +00:00
Teodor Sigaev
a3cb2221f3 Fix incorrect length of lexemes in silly_cmp_tsvector() 2006-08-29 13:32:21 +00:00
Teodor Sigaev
747b82aa6a Fix regression tests: after changing comparing function
order is changed.
2006-08-25 07:39:22 +00:00
Teodor Sigaev
2ec2b2caf0 Fix compare bug for tsvector: problem was in aligment. Per Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> and Phil Frost <indigo@bitglue.com> 2006-08-24 17:38:00 +00:00
Bruce Momjian
368f3b2cca In new "invalid byte sequence" error hint, call it "error", not
"failure".
2006-08-22 12:11:38 +00:00
Bruce Momjian
d16e2ceb59 Add hint for "invalid byte sequence for encoding" error message,
suggesting review of client_encoding.
2006-08-22 03:38:13 +00:00
Tom Lane
574878f110 Remove obsolete tip about casting bool to int, per Taiki Yamaguchi. 2006-08-21 16:24:02 +00:00
Andrew Dunstan
331428205b Add installcheck-parallel target to top level makefiles. 2006-08-18 19:58:34 +00:00
Michael Meskes
9084f700e5 Backported buffer overrun from HEAD 2006-08-18 16:33:29 +00:00
Michael Meskes
017d79b10d Applied the connect patch from HEAD. 2006-08-18 16:00:06 +00:00
Tom Lane
7ed55aac1c Get rid of "lookahead" functionality in plpgsql's yylex() function,
and instead make the grammar production for the RETURN statement do the
heavy lifting.  The lookahead idea was copied from the main parser, but
it does not work in plpgsql's parser because here gram.y looks explicitly
at the scanner's yytext variable, which will be out of sync after a
failed lookahead step.  A minimal example is

create or replace function foo() returns void language plpgsql as '
begin
  perform return foo bar;
end';

which can be seen by testing to deliver "foo foo bar" to the main parser
instead of the expected "return foo bar".  This isn't a huge bug since
RETURN is not found in the main grammar, but it could bite someone who
tried to use "return" as an identifier.

Back-patch to 8.1.  Bug exists further back, but HEAD patch doesn't apply
cleanly, and given the lack of field complaints it doesn't seem worth
the effort to develop adjusted patches.
2006-08-14 00:46:59 +00:00
Tom Lane
e4596d8e60 Fix core dump in duration logging for a V3-protocol Execute message
when what's being executed is a COMMIT or ROLLBACK.  Per report from
Sergey Koposov.  Backpatch to 8.1; 8.0 and before don't have the bug
due to lack of any logging at all here.
2006-08-13 22:18:22 +00:00
Bruce Momjian
b6f564c012 Move Win32 inline define to win32.h so it is found, rather than c.h.
(cleaner)
2006-08-10 01:45:17 +00:00