Tom Lane [Wed, 26 Jan 2005 17:09:28 +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:24:30 +0000 (02:24 +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.
Tom Lane [Thu, 18 Nov 2004 01:19:57 +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().
Tom Lane [Fri, 22 Oct 2004 00:24:33 +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.
Tom Lane [Wed, 13 Oct 2004 22:22:22 +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, 17 Sep 2004 18:29:24 +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.
Tom Lane [Wed, 11 Aug 2004 04:08:40 +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.
Tom Lane [Tue, 2 Mar 2004 21:15:15 +0000 (21:15 +0000)]
Always schema-qualify the name of a function referenced in CREATE CAST.
The former coding failed if the cast function was not in the pg_catalog
schema. How'd this escape detection?
Joe Conway [Tue, 24 Feb 2004 06:07:52 +0000 (06:07 +0000)]
When returning type "record", replace use of pgresultGetTupleDesc
with ReturnSetInfo->expectedDesc. This allows custom datatypes
(e.g. from tsearch2) to be returned at runtime. Previous behavior
depended on the type oid to match between the remote and local
database, which obviously doesn't work well for custom types.
Per report from Mark Gibson.
Joe Conway [Sun, 1 Feb 2004 04:05:13 +0000 (04:05 +0000)]
Fix text_position to not scan past end of source string in multibyte
case, per report from Korea PostgreSQL Users' Group. Copied from Tom
Lane's 7.4 branch patch.
Tom Lane [Mon, 26 Jan 2004 19:16:40 +0000 (19:16 +0000)]
Repair incorrect order of operations in GetNewTransactionId(). We must
complete ExtendCLOG() before advancing nextXid, so that if that routine
fails, the next incoming transaction will try it again. Per trouble
report from Christopher Kings-Lynne.
Tom Lane [Wed, 14 Jan 2004 03:39:36 +0000 (03:39 +0000)]
Revert ill-starred change of 13-Feb-02: it appeared to fix a problem of
incorrect permissions checking, but in fact disabled most all permissions
checks for view updates. This corrects problems reported by Sergey
Yatskevich among others, at the cost of re-introducing the problem
previously reported by Tim Burgess. However, since we'd lived with that
problem for quite awhile without knowing it, we can live with it awhile
longer until a proper fix can be made in 7.5.
Joe Conway [Sun, 7 Dec 2003 04:11:26 +0000 (04:11 +0000)]
Repair indexed bytea like operations, and related selectivity
functionality. Per bug report by Alvar Freude:
http://archives.postgresql.org/pgsql-bugs/2003-12/msg00022.php
Tom Lane [Mon, 1 Dec 2003 16:53:42 +0000 (16:53 +0000)]
Force zero_damaged_pages to be effectively ON during recovery from WAL,
since there is no need to worry about damaged pages when we are going to
overwrite them anyway from the WAL. Per recent discussion.
Tom Lane [Sun, 30 Nov 2003 22:24:16 +0000 (22:24 +0000)]
Back-patch fix to check vartypmod when matching PlannerParamVar entries.
This should prevent some obscure cases of 'variable not in subplan target
lists', although actual failures have only been reported against 7.4 in
which the bug is much easier to trigger.
Tom Lane [Sun, 30 Nov 2003 21:56:36 +0000 (21:56 +0000)]
Back-patch fix to cause stats processes to detach from shared memory,
so that they do not prevent the postmaster from deleting the shmem segment
during crash recovery.
Joe Conway [Sun, 30 Nov 2003 20:52:37 +0000 (20:52 +0000)]
Make PQescapeBytea and byteaout consistent with each other, and
octal escape all octets outside the range 0x20 to 0x7e. This fixes
the problem pointed out by Sergey Yatskevich here:
http://archives.postgresql.org/pgsql-bugs/2003-11/msg00140.php
Jan Wieck [Fri, 31 Oct 2003 03:57:42 +0000 (03:57 +0000)]
Fix for possible referential integrity violation when a qualified ON INSERT
rule split the query into one INSERT and one UPDATE where the UPDATE
then hit's the just created row without modifying the key fields again.
In this special case, the new key slipped in totally unchecked.
Jan Wieck [Thu, 30 Oct 2003 02:00:44 +0000 (02:00 +0000)]
Support for qualified type names in PL/Tcl's spi_prepare command.
This is not 100% backward compatible as formerly a double quoted
type name containing a dot could be used. But I don't think may people
use dot's in the name of user defined types.
Tom Lane [Mon, 20 Oct 2003 20:02:30 +0000 (20:02 +0000)]
It is possible for ResolveNew to be used to insert a sublink into a
subquery that didn't previously have one. We have traditionally made
the caller of ResolveNew responsible for updating the hasSubLinks flag
of the outermost query, but this fails to account for hasSubLinks in
subqueries. Fix ResolveNew to handle this. We might later want to
change the calling convention of ResolveNew so that it can fix the
outer query too, simplifying callers. But I went with the localized
fix for now. Per bug report from J Smith, 20-Oct-03.
Tom Lane [Thu, 2 Oct 2003 22:25:08 +0000 (22:25 +0000)]
When dumping CREATE INDEX, must show opclass name if the opclass isn't
in the schema search path. Otherwise pg_dump doesn't correctly dump
scenarios where a custom opclass is created in 'public' and then used
by indexes in other schemas.
Bruce Momjian [Mon, 29 Sep 2003 18:53:08 +0000 (18:53 +0000)]
[ Patch applied only to 7.3.X.]
Hi There's a bug in the clusterdb script where it looks like the arguments
to the psql command are being passed in the wrong order, so it fails when
you run it on a database that is not on localhost.
Here's the output from the command:
133 anands-Computer:bin/scripts> clusterdb -h wooster -U rr granada
psql: warning: extra option wooster ignored
psql: warning: extra option -U ignored
psql: warning: extra option rr ignored
psql: warning: extra option -F: ignored
psql: warning: extra option -P ignored
psql: warning: extra option format=unaligned ignored
psql: warning: extra option -t ignored
psql: warning: extra option -c ignored
psql: warning: extra option SELECT nspname, pg_class.relname,
pg_class_2.relname FROM pg_class, pg_class AS pg_class_2 JOIN pg_namespace
ON (pg_namespace.oid=relnamespace), pg_index WHERE
pg_class.oid=pg_index.indrelid AND pg_class_2.oid=pg_index.indexrelid AND
pg_index.indisclustered AND pg_class.relowner=(SELECT usesysid FROM
pg_user WHERE usename=current_user) ignored
psql: FATAL: user "-h" does not exist
I'm attaching a patch that fixes the problem. The diff was run on
postgresql 7.3.4
Barry Lind [Thu, 7 Aug 2003 17:56:27 +0000 (17:56 +0000)]
Backport to 7.3. Third try to fix the sql injection
vulnerability. This fix completely removes the ability (hack) of being able
to bind a list of values in an in clause. It was demonstrated that by allowing
that functionality you open up the possibility for certain types of
sql injection attacks. The previous fix attempts all focused on preventing
the insertion of additional sql statements (the semi-colon problem:
xxx; any new sql statement here). But that still left the ability to
change the where clause on the current statement or perform a subselect
which can circumvent applicaiton security logic and/or allow you to call
any stored function.
Tom Lane [Tue, 5 Aug 2003 17:39:36 +0000 (17:39 +0000)]
Fix several places where fractional-second inputs were misprocessed
in HAVE_INT64_TIMESTAMP cases, including two potential stack smashes
when more than six fractional digits were supplied. Per bug report
from Philipp Reisner.
Tom Lane [Mon, 4 Aug 2003 17:58:25 +0000 (17:58 +0000)]
SSL_read/SSL_write do not approximate the return conventions of recv()
and send() very well at all; and in any case we can't use retval==0
for EOF due to race conditions. Make the same fixes in the backend as
are required in libpq.
Tom Lane [Tue, 29 Jul 2003 22:18:48 +0000 (22:18 +0000)]
Fix longstanding error in _bt_search(): should moveright at top of loop not
bottom. Otherwise we fail to moveright when the root page was split while
we were "in flight" to it. This is not a significant problem when the root
is above the leaf level, but if the root was also a leaf (ie, a single-page
index just got split) we may return the wrong leaf page to the caller,
resulting in failure to find a key that is in fact present. Bug has existed
at least since 7.1, probably forever.
Barry Lind [Wed, 23 Jul 2003 23:34:31 +0000 (23:34 +0000)]
Patch to fix additional SQL injection vulnerabilities reported by Oliver Jowett
and Dmitry Tkach
Modified Files:
Tag: REL7_3_STABLE
jdbc/org/postgresql/Driver.java.in
jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
Barry Lind [Tue, 22 Jul 2003 05:13:05 +0000 (05:13 +0000)]
Fix to prevent SQL injection attacks when calling setObject(int,Object,int)
where the Object is a String and the type is numeric (i.e. INTEGER,LONG,etc).
The fix applies the standard escaping for these values.
Tom Lane [Thu, 17 Jul 2003 20:14:09 +0000 (20:14 +0000)]
For COMMENT ON DATABASE where database name is unknown or not the current
database, emit a WARNING and do nothing, rather than raising ERROR.
Per recent discussion in which we concluded this is the best way to deal
with database dumps that are reloaded into a database of a new name.
Tom Lane [Thu, 17 Jul 2003 16:45:25 +0000 (16:45 +0000)]
Repair boundary-case bug introduced by patch of two months ago that
fixed incorrect initial setting of StartUpID. The logic in XLogWrite()
expects that Write->curridx is advanced to the next page as soon as
LogwrtResult points to the end of the current page, but StartupXLOG()
failed to make that happen when the old WAL ended exactly on a page
boundary. Per trouble report from Hannu Krosing.
Tom Lane [Wed, 25 Jun 2003 20:07:54 +0000 (20:07 +0000)]
Don't generate 'zero' typeids in the output from gen_cross_product.
This is no longer necessary or appropriate since we don't use zero typeid
as a wildcard anymore, and it fixes a nasty performance problem with
functions with many parameters. Per recent example from Reuven Lerner.
Bruce Momjian [Wed, 25 Jun 2003 04:09:15 +0000 (04:09 +0000)]
[ Backpatch to 7.3.X.]
If they're not, the below causes problems, as the foreign key is added
after the CHECK. Cluster depends on the index name, so I thought it
wise to ensure all names are available, rather than leaving off the
CONSTRAINT "$n" portion for internally named constraints.
Tom Lane [Fri, 6 Jun 2003 16:25:52 +0000 (16:25 +0000)]
Add defense in assign_session_authorization() against trying to do
catalog lookups when not in a transaction. This prevents bizarre
failures if someone tries to set a value for session_authorization in
postgresql.conf. Per report from Fernando Nasser.