Commit graph

14142 commits

Author SHA1 Message Date
Neil Conway
5ba26d48fc Correct some code in pg_restore when reading the header of a tar archive:
(1) The code doesn't initialize `sum', so the initial "does the checksum
    match?" test is wrong.

(2) The loop that is intended to check for a "null block" just checks
    the first byte of the tar block 512 times, rather than each of the
    512 bytes one time (!), which I'm guessing was the intent.

It was only through sheer luck that this worked in the first place.

Per Coverity static analysis performed by EnterpriseDB.
2005-06-22 02:02:09 +00:00
Neil Conway
5bcb851c92 Fix a potential backend crash during authentication when parsing a
malformed ident map file.  This was introduced by the linked list
rewrite in 8.0 -- mea maxima culpa.

Per Coverity static analysis performed by EnterpriseDB.
2005-06-21 01:23:25 +00:00
Tom Lane
7d32f099d7 exec_eval_datum leaks memory when dealing with ROW or REC values.
It never leaked memory before PG 8.0, so none of the callers are
expecting this.  Cleanest fix seems to be to make it allocate the needed
memory in estate->eval_econtext, where it will be cleaned up by
the next exec_eval_cleanup.  Per report from Bill Rugolsky.
2005-06-20 22:51:49 +00:00
Tom Lane
c541ca6403 plpgsql's exec_assign_value() freed the old value of a variable before
copying/converting the new value, which meant that it failed badly on
"var := var" if var is of pass-by-reference type.  Fix this and a similar
hazard in exec_move_row(); not sure that the latter can manifest before
8.0, but patch it all the way back anyway.  Per report from Dave Chapeskie.
2005-06-20 20:44:50 +00:00
Tom Lane
558ff41f27 When using C-string lookup keys in a dynahash.c hash table, use strncpy()
not memcpy() to copy the offered key into the hash table during HASH_ENTER.
This avoids possible core dump if the passed key is located very near the
end of memory.  Per report from Stefan Kaltenbrunner.
2005-06-18 20:51:44 +00:00
Peter Eisentraut
7a91540202 Translation updates 2005-06-17 11:42:02 +00:00
Tom Lane
d9de1bb47a The random selection in function linear() could deliver a value equal to max
if geqo_rand() returns exactly 1.0, resulting in failure due to indexing
off the end of the pool array.  Also, since this is using inexact float math,
it seems wise to guard against roundoff error producing values slightly
outside the expected range.  Per report from bug@zedware.org.
2005-06-14 14:21:23 +00:00
Tatsuo Ishii
8bedb71888 Fix bug in MIC -> EUC_JP conversion. Per Atsushi Ogawa. 2005-06-11 02:46:16 +00:00
Tom Lane
6bbd271a1e Use just NULL not NULL::TEXT --- the latter coding is unnecessary and
not schema-safe.  Per report from Jochem van Dieten.
2005-06-07 14:05:01 +00:00
Tom Lane
2f5b2558d3 Code for SET/SHOW TIME ZONE with a fixed-interval timezone was not
prepared for HAVE_INT64_TIMESTAMP.  Per report from Guillaume Beaudoin.
2005-06-05 01:48:45 +00:00
Tom Lane
543bb05a8b Push enable/disable of notify and catchup interrupts all the way down
to just around the bare recv() call that gets a command from the client.
The former placement in PostgresMain was unsafe because the intermediate
processing layers (especially SSL) use facilities such as malloc that are
not necessarily re-entrant.  Per report from counterstorm.com.
2005-06-02 21:03:46 +00:00
Michael Meskes
53b4a1ce4b Added patch by Gavin Scott <gavin@planetacetech.com> for Intel 64bit hardware.
[One half already was committed with the last commit.]
2005-06-02 12:49:26 +00:00
Michael Meskes
d014a21624 Fixed memory leak in ecpglib by adding some missing free() commands. 2005-06-02 12:37:25 +00:00
Bruce Momjian
7b21f26ea7 Fix log_statement to properly recognize SELECT INTO and CREATE TABLE AS
and DDL statements.

Backpatch fix to 8.0.X.

Per report from Murthy Kambhampaty
2005-06-01 23:27:12 +00:00
Tom Lane
64f40008ec patternsel() was improperly stripping RelabelType from the derived
expressions it constructed, causing scalarineqsel to become confused
if the underlying variable was of a domain type.  Per report from
Kevin Grittner.
2005-06-01 17:05:25 +00:00
Tom Lane
3b3600148d Add test to WAL replay to verify that xl_prev points back to the previous
WAL record; this is necessary to be sure we recognize stale WAL records
when a WAL page was only partially written during a system crash.
2005-05-31 19:10:39 +00:00
Tom Lane
1c69be95f9 expandRTE and get_rte_attribute_type mistakenly always imputed typmod -1
to columns of an RTE that was a function returning RECORD with a column
definition list.  Apparently no one has tried to use non-default typmod
with a function returning RECORD before.
2005-05-29 17:10:35 +00:00
Neil Conway
92525dd6c9 Adjust datetime parsing to be more robust. We now pass the length of the
working buffer into ParseDateTime() and reject too-long input there,
rather than checking the length of the input string before calling
ParseDateTime(). The old method was bogus because ParseDateTime() can use
a variable amount of working space, depending on the content of the
input string (e.g. how many fields need to be NUL terminated). This fixes
a minor stack overrun -- I don't _think_ it's exploitable, although I
won't claim to be an expert.

Along the way, fix a bug reported by Mark Dilger: the working buffer
allocated by interval_in() was too short, which resulted in rejecting
some perfectly valid interval input values. I added a regression test for
this fix.
2005-05-26 02:10:03 +00:00
Peter Eisentraut
9a1a986580 Translation updates 2005-05-25 08:37:22 +00:00
Tatsuo Ishii
afc0e843b9 Fix previous patch to exprTypmod. 2005-05-25 02:17:55 +00:00
Tatsuo Ishii
2a99455ca7 Inserting 5 characters into char(10) does not produce 5 padding spaces
if they are two-byte multibyte characters. Same thing can be happen
if octet_length(multibyte_chars) == n where n is char(n).
Long standing bug since 7.3 days. Per report and fix from Yoshiyuki Asaba.
2005-05-24 23:02:54 +00:00
Tom Lane
a94ace0796 Previous fix for "x FULL JOIN y ON true" failed to handle the case
where there was also a WHERE-clause restriction that applied to the
join.  The check on restrictlist == NIL is really unnecessary anyway,
because select_mergejoin_clauses already checked for and complained
about any unmergejoinable join clauses.  So just take it out.
2005-05-24 18:02:55 +00:00
Neil Conway
6d493ed7f5 Fix typo in PL/Perl Safe.pm initialization that prevented the proper
sharing of %_SHARED. From Andrew Dunstan.
2005-05-23 02:02:52 +00:00
Tom Lane
626be474d3 Guard against duplicate IDs in input file in SortTocFromFile().
Per report from Brian Hackett.
2005-05-17 17:30:41 +00:00
Bruce Momjian
fd4d6853b7 Add -N make flag to bcc builds from /src dir. 2005-05-13 18:13:16 +00:00
Neil Conway
9ac4af6847 Fix bug in COPY CSV mode: handle consecutive embedded newlines in COPY
input. Also add a regression test for this bug. From Andrew Dunstan.
2005-05-13 06:35:25 +00:00
Tom Lane
16379e3ae5 Update release checklist to reflect that HISTORY and INSTALL don't
need to be created by hand anymore.
2005-05-08 23:34:23 +00:00
Tom Lane
d6e30b0ba0 Repair very-low-probability race condition between relation extension
and VACUUM: in the interval between adding a new page to the relation
and formatting it, it was possible for VACUUM to come along and decide
it should format the page too.  Though not harmful in itself, this would
cause data loss if a third transaction were able to insert tuples into
the vacuumed page before the original extender got control back.
2005-05-07 21:32:53 +00:00
Tom Lane
aba1f93e45 Adjust time qual checking code so that we always check TransactionIdIsInProgress
before we check commit/abort status.  Formerly this was done in some paths
but not all, with the result that a transaction might be considered
committed for some purposes before it became committed for others.
Per example found by Jan Wieck.
2005-05-07 21:22:36 +00:00
Tom Lane
17eb867e98 Stamp release 8.0.3. 2005-05-05 20:07:36 +00:00
Tom Lane
266a8975da Make standalone backends ignore pg_database.datallowconn, so that there
is a way to recover from disabling connections to all databases at once.
2005-05-05 19:53:37 +00:00
Bruce Momjian
fbacd7838c Add WSACleanup() for Win32 socket cleanup.
Jason Erickson
2005-05-05 16:36:20 +00:00
Tom Lane
b22bbd6f6e Use postmaster_is_alive() check in pg_ctl restart as well as pg_ctl status,
so that restart doesn't fail when old postmaster died unbetimes.
2005-05-04 22:35:22 +00:00
Tom Lane
32083d2a5c Spell DELIMITER correctly, per Seamus Dean. 2005-05-04 14:25:30 +00:00
Tom Lane
4afab9639a Alter the signature for encoding conversion functions to declare the
output area as INTERNAL not CSTRING.  This is to prevent people from
calling the functions by hand.  This is a permanent solution for the
back branches but I hope it is just a stopgap for HEAD.
2005-05-03 19:18:16 +00:00
Tom Lane
298e077bc4 Change tsearch2 to not use the unsafe practice of creating functions
that return INTERNAL without also having INTERNAL arguments.  Since the
functions in question aren't meant to be called by hand anyway, I just
redeclared them to take 'internal' instead of 'text'.  Also add code
to ProcedureCreate() to enforce the restriction, as I should have done
to start with :-(
2005-05-03 16:51:22 +00:00
Dennis Bjorklund
d0069f5a71 Fix a whitespace problem. From Alvaro Herrera. 2005-05-03 06:28:24 +00:00
Tom Lane
50433d6533 Make record_out and record_send extract type information from the passed
record object itself, rather than relying on a second OID argument to be
correct.  This patch just changes the function behavior and not the
catalogs, so it's OK to back-patch to 8.0.  Will remove the now-redundant
second argument in pg_proc in a separate patch in HEAD only.
2005-04-30 20:04:46 +00:00
Neil Conway
757956ec47 GCC 4.0 includes a new warning option, -Wformat-literal, that emits
a warning when a variable is used as a format string for printf()
and similar functions (if the variable is derived from untrusted
data, it could include unexpected formatting sequences). This
emits too many warnings to be enabled by default, but it does
flag a few dubious constructs in the Postgres tree. This patch
fixes up the obvious variants: functions that are passed a variable
format string but no additional arguments.

Most of these are harmless (e.g. the ruleutils stuff), but there
is at least one actual bug here: if you create a trigger named
"%sfoo", pg_dump will read uninitialized memory and fail to dump
the trigger correctly.
2005-04-30 08:19:44 +00:00
Neil Conway
7ce01797bd This patch fixes a bug in the error message emitted by pg_restore on an
incorrect -F argument: write_msg() expects its first parameter to be a
"module name", not the format string.
2005-04-30 08:00:14 +00:00
Bruce Momjian
f22b3b2760 Improve cleanup from win32 client-only build. 2005-04-29 14:07:34 +00:00
Bruce Momjian
5f9d19cc23 Backpatch BCC compile changes to 8.0.X for psql. 2005-04-29 13:42:24 +00:00
Bruce Momjian
95cb42b968 Fix Borland makefile for libpq and improve it for psql.
Reorder MSC makefile to be more consistent and easier to maintain.
2005-04-29 04:21:39 +00:00
Tom Lane
582dcae7e8 Repair two TIME WITH TIME ZONE bugs found by Dennis Vshivkov. Comparison
of timetz values misbehaved in --enable-integer-datetime cases, and
EXTRACT(EPOCH) subtracted the zone instead of adding it in all cases.
Backpatch to all supported releases (except --enable-integer-datetime code
does not exist in 7.2).
2005-04-23 22:53:26 +00:00
Tom Lane
1275ad5056 Make pg_ctl status do a kill() test to verify that the PID found in
postmaster.pid still represents a live postmaster.
2005-04-20 23:10:22 +00:00
Tom Lane
eecc92564d Don't try to run clauseless index scans on index types that don't support
it.  Per report from Marinos Yannikos.
2005-04-20 21:48:12 +00:00
Tom Lane
25bd3019e0 Fix mis-display of negative fractional seconds in interval values for
--enable-integer-datetimes case.  Per report from Oliver Siegmar.
2005-04-20 17:14:58 +00:00
Tom Lane
92645c42c8 pg_dumpall should enforce the server version check for itself, rather
than simply passing it down to pg_dump.  Else, version-related failures
in pg_dumpall itself generate unhelpful error messages.
2005-04-18 23:48:01 +00:00
Tom Lane
1186365c3c record_in and record_recv must be careful to return a separately
pfree'able result, since some callers expect to be able to pfree
the result of a pass-by-reference function.  Per report from Chris Trawick.
2005-04-18 17:11:15 +00:00
Bruce Momjian
96d61bc163 Fix comment typo. 2005-04-15 22:49:45 +00:00