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.
Tom Lane [Thu, 22 May 2003 14:39:49 +0000 (14:39 +0000)]
Repair sometimes-incorrect computation of StartUpID after a crash, per
example from Rao Kumar. This is a very corner corner-case, requiring
a minimum of three closely-spaced database crashes and an unlucky
positioning of the second recovery's checkpoint record before you'd notice
any problem. But the consequences are dire enough that it's a must-fix.
Tom Lane [Mon, 19 May 2003 17:23:54 +0000 (17:23 +0000)]
Back-patch change to avoid O(N^2) behavior with lots of deferred triggers,
by making deferredTriggerInvokeEvents only scan events added since it last ran.
Tom Lane [Sat, 10 May 2003 18:01:49 +0000 (18:01 +0000)]
Adjust CreateCheckpoint so that buffer dumping activities and cleanup of
dead xlog segments are not considered part of a critical section. It is
not necessary to force a database-wide panic if we get a failure in these
operations. Per recent trouble reports.
Tom Lane [Sun, 4 May 2003 04:30:35 +0000 (04:30 +0000)]
Allow 60 in seconds fields of timestamp, time, interval input values.
Per recent discussion on pgsql-general, this is appropriate for spec
compliance, and has the nice side-effect of easing porting from old
pg_dump files that exhibit the 59.999=>60.000 roundoff problem.
Tom Lane [Sun, 4 May 2003 00:04:10 +0000 (00:04 +0000)]
When a TIMESTAMP, TIME, or INTERVAL precision is specified larger than our
implementation limits, do not issue an ERROR; instead issue a NOTICE and use
the max supported value. Per pgsql-general discussion of 28-Apr, this is
needed to allow easy porting from pre-7.3 releases where the limits were
higher.
Unrelated change in same area: accept GLOBAL TEMP/TEMPORARY as a synonym
for TEMPORARY, as per pgsql-hackers discussion of 15-Apr. We previously
rejected it, but that was based on a misreading of the spec --- SQL92's
GLOBAL temp tables are really closer to what we have than their LOCAL ones.
Tom Lane [Sat, 3 May 2003 22:19:18 +0000 (22:19 +0000)]
Fix erroneous space calculation leading to core dump in dumpProcLangs,
per report from Olivier Prenant. Also fix off-by-one space calculation
in ReadToc; this woould not have hurt us until we had more than 100
dependencies for a single object, but wrong is wrong.
Tom Lane [Sat, 26 Apr 2003 22:21:58 +0000 (22:21 +0000)]
Repair permissions problem in RI triggers: query parsing has to be done
as the correct user, not only query execution. Per report from Sean
Chittenden.
Tom Lane [Sat, 26 Apr 2003 15:19:05 +0000 (15:19 +0000)]
Correct oversight in createlang: test for pre-existing handler function
was broken by opaque->language_handler change. I see this is already
fixed in CVS tip, but must back-patch for 7.3.3.
Tom Lane [Sun, 20 Apr 2003 17:37:22 +0000 (17:37 +0000)]
Fix char-vs-pg_wchar confusion in p_ere(), per failure report from
Tom O'Dowd. This fix is not relevant to CVS tip anymore, but we should
fix it in 7.3.*.
Tom Lane [Thu, 17 Apr 2003 04:50:35 +0000 (04:50 +0000)]
Fix abstime-to-time cast function, which has had broken implementation
since 7.2, per bug #947. Turns out it had wrong volatility label, too.
Can't force initdb in 7.3 branch, but fix anyway for future installs.
Barry Lind [Thu, 17 Apr 2003 04:19:55 +0000 (04:19 +0000)]
Applied patches from Kris Jurka fixing a string tokenizing problem and
fixing an order by problem for index metadata results.
Also includes removing some unused code as well as a fix to the toString
method on statement.
Tom Lane [Tue, 15 Apr 2003 05:18:30 +0000 (05:18 +0000)]
eqjoinsel's logic for case where MCV lists are not present should
account for NULLs; in hindsight this is obvious since the code for
the MCV-lists case would reduce to this when there are zero entries
in both lists. Per example from Alec Mitchell.
Tom Lane [Thu, 10 Apr 2003 02:47:57 +0000 (02:47 +0000)]
Remove premature attempt to constant-fold type coercion expressions.
While usually safe, this fails if the coercion function needs the
query snapshot to be set already. Per example from Nigel Andrews.
Tom Lane [Fri, 4 Apr 2003 00:32:57 +0000 (00:32 +0000)]
Back-patch changes to validate page header fields immediately after
reading in any page. Also back-port the zero_damaged_pages boolean
that determines what to do about it.
Tom Lane [Mon, 31 Mar 2003 20:32:50 +0000 (20:32 +0000)]
TestConfiguration returns int, not bool. This mistake is relatively
harmless on signed-char machines but would lead to core dump in the
deadlock detection code if char is unsigned. Amazingly, this bug has
been here since 7.1 and yet wasn't reported till now. Thanks to Robert
Bruccoleri for providing the opportunity to track it down.