Tom Lane [Sat, 19 Feb 2005 19:33:42 +0000 (19:33 +0000)]
Ensure that the resolved datatype of any unknown Param is propagated
into the sub-SELECT targetlist when it appears in the context
INSERT INTO foo SELECT $1 ... Per report from Abhijit Menon-Sen.
Neil Conway [Mon, 7 Feb 2005 03:55:28 +0000 (03:55 +0000)]
Prevent 4 more buffer overruns in the PL/PgSQL parser. This is just a
minimally-invasive fix for stable branches; a cleaner fix will be
committed to HEAD soon.
Tom Lane [Sun, 6 Feb 2005 20:19:42 +0000 (20:19 +0000)]
Repair CLUSTER failure after ALTER TABLE SET WITHOUT OIDS. Turns out
there are corner cases involving dropping toasted columns in which the
previous coding would fail, too: the new version of the table might not
have any TOAST table, but we'd still propagate possibly-wide values of
dropped columns forward.
Tom Lane [Wed, 26 Jan 2005 17:09:21 +0000 (17:09 +0000)]
Back-patch 8.0 version of plperl_hash_from_tuple() into prior releases
to fix failure to cope with quote marks in field values; not to mention
that it is shorter and faster. Per report from Charles Haron.
Tom Lane [Sun, 23 Jan 2005 02:23:30 +0000 (02:23 +0000)]
The result of a FULL or RIGHT join can't be assumed to be sorted by the
left input's sorting, because null rows may be inserted at various points.
Per report from Ferenc Lutischá¸n.
Neil Conway [Fri, 21 Jan 2005 00:31:21 +0000 (00:31 +0000)]
Prevent overrunning a heap-allocated buffer if more than 1024 parameters
to a refcursor declaration are specified. This is a minimally-invasive fix
for the buffer overrun -- a more thorough cleanup will be checked into
HEAD.
Tom Lane [Thu, 23 Dec 2004 22:42:32 +0000 (22:42 +0000)]
Avoid memory leakage during VACUUM FULL when an index expression or
index predicate uses temporary memory for evaluation. Per example
from Jean-Gerard Pailloncy.
Tom Lane [Fri, 3 Dec 2004 21:26:52 +0000 (21:26 +0000)]
Use StrNCpy not strncpy to fill hash key, to ensure the resulting key
is null-terminated. I think this is not a real bug because the parser
would always have truncated the identifier to NAMEDATALEN-1 already,
but let's be safe. Per report from Klocwork.
Tom Lane [Thu, 2 Dec 2004 02:45:24 +0000 (02:45 +0000)]
Teach regex_fixed_prefix() the correct handling of advanced regex
escapes --- they aren't simply quoted characters. Problem noted by
Antti Salmela. Also fix problem with incorrect handling of multibyte
characters when followed by a quantifier.
Tom Lane [Sun, 28 Nov 2004 22:16:49 +0000 (22:16 +0000)]
Avoid scribbling on original parsetree during DECLARE CURSOR. This
prevents problems when the DECLARE is in a portal and is executed
repeatedly, as is possible in v3 protocol. Per analysis by Oliver
Jowett, though I didn't use his patch exactly.
Tom Lane [Wed, 24 Nov 2004 22:57:09 +0000 (22:57 +0000)]
Install Tcl regex fixes to sync our regex engine with Tcl 8.4.8 (up from
8.4.1). This corrects some curious regex bugs, though not the greediness
issue I was hoping to find a solution for :-(
Tom Lane [Wed, 24 Nov 2004 22:44:27 +0000 (22:44 +0000)]
Our interface code for Spencer's regexp package was checking for regexp
error conditions during regexp compile, but not during regexp execution;
any sort of "can't happen" errors would be treated as no-match instead
of being reported as they should be. Noticed while trying to duplicate
a reported Tcl bug.
Tom Lane [Thu, 18 Nov 2004 01:19:40 +0000 (01:19 +0000)]
Back-patch fix for ALTER DATABASE failing to flush pg_database changes
to disk right away. This is just a one-liner change rather than trying
to use FlushRelationBuffers().
Neil Conway [Wed, 17 Nov 2004 00:18:26 +0000 (00:18 +0000)]
Backpatch fix from HEAD:
Prevent a backend crash when processing CREATE TABLE commands with
more than 65K columns, or when the created table has more than 65K columns
due to adding inherited columns from parent relations. Fix a similar
crash when processing SELECT queries with more than 65K target list
entries. In all three cases we would eventually detect the error and
elog, but the check was being made too late.
Tom Lane [Tue, 9 Nov 2004 20:35:16 +0000 (20:35 +0000)]
In PGSharedMemoryIsInUse, assume that EACCES indicates a shmem segment
that is of no concern to us --- it must belong to a different userid,
which means it is not a Postgres shmem segment (or at least,
not one that is relevant to our data directory). I plan a more extensive
fix in HEAD, but this is a simple change that prevents failure-to-reboot
problems for single-postmaster installations.
Tom Lane [Fri, 22 Oct 2004 00:24:27 +0000 (00:24 +0000)]
Prevent pg_ctl from being run as root. Since it uses configuration files
owned by postgres, doing "pg_ctl start" as root could allow a privilege
escalation attack, as pointed out by iDEFENSE. Of course the postmaster would
fail, but we ought to fail a little sooner to protect sysadmins unfamiliar
with Postgres. The chosen fix is to disable root use of pg_ctl in all cases,
just to be confident there are no other holes.
Kris Jurka [Thu, 21 Oct 2004 19:13:55 +0000 (19:13 +0000)]
Correctly cast the return value of a CallableStatement when getShort
is called. getByte presents a can't happen situation as no function
can return a TINYINT because pg doesn't have an equivalent type.
Make this throw an exception if we get to this point.
Tom Lane [Wed, 13 Oct 2004 22:22:03 +0000 (22:22 +0000)]
Repair possible failure to update hint bits back to disk, per
http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php.
I plan a more permanent fix in HEAD, but for the back branches it seems
best to just touch the places that actually have a problem.
Tom Lane [Fri, 1 Oct 2004 21:09:46 +0000 (21:09 +0000)]
Convert pg_stat_get_backend_idset to use the existing SRF support.
This seems the cleanest way of fixing its lack of a shutdown callback,
which was preventing it from working correctly in a query that didn't
run it to completion. Per bug report from Szima GÄbor.
Tom Lane [Sun, 26 Sep 2004 00:26:56 +0000 (00:26 +0000)]
Repair bug that would allow libpq to think a command had succeeded when
it really hadn't, due to double output of previous command's response.
Fix prevents recursive entry to libpq routines. Found by Jan Wieck.
Tom Lane [Fri, 17 Sep 2004 18:29:10 +0000 (18:29 +0000)]
Hashed LEFT JOIN would miss outer tuples with no inner match if the join
was large enough to be batched and the tuples fell into a batch where
there were no inner tuples at all. Thanks to Xiaoyu Wang for finding a
test case that exposed this long-standing bug.
Protected access to variable m_preparedCount via synchronized
function to prevent multiple threads using automatic cursors on
the same connection from stomping over each others cursor.
Originally Jan Wieck, re-reported by Jack Orenstein after
accidental removal.
ResultSet.moveToCurrentRow was checking the cached updateability flag
assuming it had been set instead of correctly calling the
isUpdateable() method which sets the flag if needed. This usually
worked because moveToCurrentRow is only useful after a
moveToInsertRow call which would set the flag, but this is not
required.
Tom Lane [Mon, 6 Sep 2004 18:23:09 +0000 (18:23 +0000)]
Back-patch fix to disallow BEGIN/COMMIT/ROLLBACK inside SQL functions.
Not sure why this isn't causing serious problems in some simple tests,
but it definitely isn't going to do anything desirable...
Tom Lane [Tue, 31 Aug 2004 23:16:36 +0000 (23:16 +0000)]
Repair 'expected both swapped tables to have TOAST tables' bug in 7.4
branch. I wasn't excited about doing this when the first report came in,
but now that we have two of 'em, I suppose it had better get fixed.
Tom Lane [Fri, 27 Aug 2004 17:47:56 +0000 (17:47 +0000)]
Make gistindex_keytest safe against NULL values. Same fix was already
made in passing for 8.0, but now that we have a bug report showing it's
needed, we should put it into 7.4 branch.
Tom Lane [Tue, 17 Aug 2004 23:16:07 +0000 (23:16 +0000)]
Fix bug introduced into _bt_getstackbuf() on 2003-Feb-21: the initial
value of 'start' could be past the end of the page, if the page was
split by some concurrent inserting process since we visited it. In
this situation the code could look at bogus entries and possibly find
a match (since after all those entries still contain what they had
before the split). This would lead to 'specified item offset is too large'
followed by 'PANIC: failed to add item to the page', as reported by Joe
Conway for scenarios involving heavy concurrent insertion activity.
Tom Lane [Wed, 11 Aug 2004 04:08:02 +0000 (04:08 +0000)]
Fix failure to guarantee that a checkpoint will write out pg_clog updates
for transaction commits that occurred just before the checkpoint. This is
an EXTREMELY serious bug --- kudos to Satoshi Okada for creating a
reproducible test case to prove its existence.
Joe Conway [Wed, 11 Aug 2004 01:02:08 +0000 (01:02 +0000)]
Hashed crosstab was dying with an SPI_finish error when the source SQL
produced no rows. Now it returns 0 rows instead. Adjusted regression
test for this case.
Tom Lane [Sat, 17 Jul 2004 17:28:47 +0000 (17:28 +0000)]
When renaming a column that participates in a foreign key, we must
force relcache rebuild for the other table as well as the column's
own table. Otherwise, already-cached foreign key triggers will stop
working. Per example from Alexander Pravking.
Tom Lane [Sat, 10 Jul 2004 18:39:44 +0000 (18:39 +0000)]
Test HAVING condition before computing targetlist of an Aggregate node.
This is required by SQL spec to avoid failures in cases like
SELECT sum(win)/sum(lose) FROM ... GROUP BY ... HAVING sum(lose) > 0;
AFAICT we have gotten this wrong since day one. Kudos to Holger Jakobs
for being the first to notice.