1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +03:00
Commit Graph

17139 Commits

Author SHA1 Message Date
57bdab7d35 Fix libpq memory leak during PQreset() --- closePGconn() was not
freeing all transient state of the PGconn object.
2005-07-13 15:26:16 +00:00
a5d10d66d1 Make libpq_gettext save and restore errno in a Windows-compatible way.
Also, back-patch fix into back branches.
2005-07-08 15:25:19 +00:00
4677334ced Fix ancient memory leak in index_create(): RelationInitIndexAccessInfo
was being called twice in normal operation, leading to a leak of one set
of relcache subsidiary info.  Per report from Jeff Gold.
2005-06-25 16:54:12 +00:00
0592a1ebc1 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:12:19 +00:00
a6f0dee775 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:57 +00:00
41d28499a2 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:59 +00:00
2b6dd51a5f Translation updates 2005-06-17 11:30:57 +00:00
a1f08fcf80 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:31 +00:00
4f3ae012fd Fix bug in MIC -> EUC_JP conversion. Per Atsushi Ogawa. 2005-06-11 02:50:07 +00:00
fe88b2043a Repair error in description of nonblocking usage of PQgetCopyData().
Per Volkan Yazici.
2005-06-09 19:08:47 +00:00
39c9398956 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:55 +00:00
b38bcb2fa0 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:04:08 +00:00
e0632407aa Fixed memory leak in ecpglib by adding some missing free() commands. 2005-06-02 12:50:30 +00:00
1891938e9c Prevent to divide by zero and range out of 0..1 2005-06-01 11:46:09 +00:00
5205024b5a 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:57 +00:00
3c6bba3072 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:52 +00:00
ab82f60119 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:14:32 +00:00
d1d5c0fe2e Translation updates 2005-05-25 08:32:14 +00:00
05a07afd51 Fix previous patch to exprTypmod. 2005-05-25 02:13:48 +00:00
de212f4910 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:15:05 +00:00
0a7b3a3649 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:03:24 +00:00
88c59aeed8 Guard against duplicate IDs in input file in SortTocFromFile().
Per report from Brian Hackett.
2005-05-17 17:30:53 +00:00
103376e075 Update release notes for upcoming re-releases. REL7_4_8 2005-05-09 00:10:22 +00:00
775fec12c6 Update release checklist to reflect that HISTORY and INSTALL don't
need to be created by hand anymore.
2005-05-08 23:34:32 +00:00
43418e8702 In Blob.getBytes(long position, int length) position is an offset
starting at 1, not zero as the driver was previously doing.

Thanks to Emmanuel Bernard for the report.
2005-05-08 23:16:58 +00:00
0053e290d9 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:33:21 +00:00
501ec7b64c 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:23:02 +00:00
26f64e4c7a Stamp release 7.4.8. 2005-05-05 20:08:35 +00:00
d9088d3071 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:49 +00:00
6067403326 Add WSACleanup() for Win32 socket cleanup.
Backpatch to 7.4.X.

Jason Erickson
2005-05-05 16:37:04 +00:00
cff25fa049 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:31 +00:00
308f01c304 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:45 +00:00
a935e36ae9 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:36:18 +00:00
15ea6d5a2f 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:55 +00:00
3b15457092 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:44 +00:00
c7b94bbad9 int_aggregate's int_enum() doesn't work correctly with arrays that
aren't 1-D, so give an error message instead of failing.  Per report
from Ron Mayer.
2005-04-23 05:39:01 +00:00
5eed8ce382 Release build 216. 2005-04-22 15:10:52 +00:00
a44f99024c Updatable ResultSets need to check for an empty ResultSet because
isBeforeFirst and isAfterLast both return false for an empty result
so the checking to make sure the user is on a valid row wasn't
working.

Also don't allow an insert without specifying at least one column
value because INSERT INTO tab() values() is a syntax error.
2005-04-22 14:48:18 +00:00
f5517ddbda When moveToCurrentRow is called and the current row is off the
end of the ResultSet we can't try to load that row because it
doesn't exist and will throw an Exception.

Reported by Prasanth.
2005-04-22 14:36:48 +00:00
08008de909 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:22 +00:00
387c398c37 Fix mis-display of negative fractional seconds in interval values for
--enable-integer-datetimes case.  Per report from Oliver Siegmar.
2005-04-20 17:15:09 +00:00
6091d62c9d Add comment about permissions on pg_ts* tables 2005-04-19 13:59:06 +00:00
e1d55f7917 When positioned before the start of a ResultSet issuing relative(0)
results in an exception being thrown when it really should be a
no-op.
2005-04-18 18:25:11 +00:00
2a35291952 Don't try to constant-fold functions returning RECORD, since the optimizer
isn't presently set up to pass them an expected tuple descriptor.  Bug has
been there since 7.3 but was just recently reported by Thomas Hallgren.
2005-04-14 21:44:35 +00:00
29028762a9 Make constant-folding produce sane output for COALESCE(NULL,NULL),
that is a plain NULL and not a COALESCE with no inputs.  Fixes crash
reported by Michael Williamson.
2005-04-10 20:58:03 +00:00
5c5c797cb2 In cost_mergejoin, the early-exit effect should not apply to the
outer side of an outer join.  Per andrew@supernews.
2005-04-04 01:43:33 +00:00
3ea32d7b1f Flush any remaining statistics counts out to the collector at process
exit.  Without this, operations triggered during backend exit (such as
temp table deletions) won't be counted ... which given heavy usage of
temp tables can lead to pg_autovacuum falling way behind on the need
to vacuum pg_class and pg_attribute.  Per reports from Steve Crawford
and others.
2005-03-31 23:21:32 +00:00
7d19650a79 Fix various comparing functions 2005-03-31 15:12:08 +00:00
12fa5c57ac Prevent to_char(interval) from dumping core on month-related formats
when a zero-month interval is given.  Per discussion with Karel.
2005-03-26 00:42:21 +00:00
3e65431bc1 array_map can't use the fn_extra field of the provided fcinfo struct as
its private storage, because that belongs to the function that it is
supposed to call.  Per report from Ezequiel Tolnay.
2005-03-24 21:51:04 +00:00