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

15448 Commits

Author SHA1 Message Date
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
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
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
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
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
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
7cec8b4e4a Stamp releases 7.3.16, 7.4.14, 8.0.9, and 8.1.5. 2006-10-09 23:39:03 +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
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
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
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
Bruce Momjian
512d7eab82 Move "#define inline __inline" from port/win32.h to c.h because Win32
interface builds like libpq need it.

Backpatch addition to 8.1.X.
2006-08-10 01:35:28 +00:00
Bruce Momjian
a42c545f62 Round microseconds on setitimer upwards. 2006-08-09 21:18:15 +00:00
Bruce Momjian
83b27b9180 On Win32, make minimum setitimer() sleep be 1ms, so sleeps < 1ms aren't
rounded down to zero.

Backpatch to 8.1.X.
2006-08-09 20:41:07 +00:00
Bruce Momjian
1e35f9aa04 Fix statement_timeout on Win32 so that it properly treats micro-seconds
as micro-seconds, rather than as 100 microseconds, as it does now.  This
actually fixes all setitimer calls on Win32, but statement_timeout is
the most visible fix.

Backpatch to 8.1.X.  8.0 works as documented.
2006-08-09 17:47:06 +00:00
Andrew Dunstan
e482136c04 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:00:00 +00:00
Tom Lane
69f3a5c9ed Fix oversight in sizing of shared buffer lookup hashtable. Because
BufferAlloc tries to insert a new mapping entry before deleting the old one
for a buffer, we have a transient need for more than NBuffers entries ---
one more in 8.1, and as many as NUM_BUFFER_PARTITIONS more in CVS HEAD.
In theory this could lead to an "out of shared memory" failure if shmem
had already been completely claimed by the time the extra entries were
needed.
2006-07-23 18:34:50 +00:00
Tom Lane
eda117dfa0 Hmm, seems --disable-spinlocks has been broken for awhile and nobody
noticed.  Fix SpinlockSemas() to report the correct count considering
that PG 8.1 adds a spinlock to each shared-buffer header.
2006-07-22 21:04:46 +00:00
Tom Lane
f141880150 Don't try to truncate multixact SLRU files in checkpoints done during xlog
recovery.  In the first place, it doesn't work because slru's
latest_page_number isn't set up yet (this is why we've been hearing reports
of strange "apparent wraparound" log messages during crash recovery, but
only from people who'd managed to advance their next-mxact counters some
considerable distance from 0).  In the second place, it seems a bit unwise
to be throwing away data during crash recovery anwyway.  This latter
consideration convinces me to just disable truncation during recovery,
rather than computing latest_page_number and pushing ahead.
2006-07-20 00:46:56 +00:00
Tom Lane
74dac69e3c 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:23 +00:00
Tom Lane
78e8400a52 Add dependency to fix parallel-make race condition. Alexander Dupuy 2006-07-14 16:45:48 +00:00
Tom Lane
e0bb171960 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:47 +00:00
Michael Meskes
bf1cd364b6 Fixed remaining Coverity bugs. 2006-07-05 10:50:06 +00:00
Alvaro Herrera
8728d4aba9 Fix memory leak introduced in the prior commit, detected by Tom Lane. 2006-06-30 16:55:41 +00:00
Alvaro Herrera
55a39e0b0b Fix use-after-free error reported by Neil Conway. 2006-06-30 15:06:16 +00:00
Tom Lane
60f46dee71 Fix typo. 2006-06-27 14:01:42 +00:00
Alvaro Herrera
4ca74397b4 Clamp last_anl_tuples to n_live_tuples, in case we vacuum a table without
analyzing, so that future analyze threshold calculations don't get confused.
Also, make sure we correctly track the decrease of live tuples cause by
deletes.

Per report from Dylan Hansen, patches by Tom Lane and me.
2006-06-27 03:45:28 +00:00
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
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