Tom Lane [Tue, 22 Oct 2002 22:44:36 +0000 (22:44 +0000)]
Perform transaction cleanup operations in a less ad-hoc, more
principled order; in particular ensure that all shared resources
are released before we release transaction locks. The code used
to release locks before buffer pins, which might explain an ancient
note I have about a bufmgr assertion failure I'd seen once several
years ago, and been unable to reproduce since. (Theory: someone
trying to drop a relation might be able to reach FlushRelationBuffers
before the last user of the relation had gotten around to dropping
his buffer pins.)
Tom Lane [Mon, 21 Oct 2002 22:06:20 +0000 (22:06 +0000)]
Fix places that were using IsTransactionBlock() as an (inadequate) check
that they'd get to commit immediately on finishing. There's now a
centralized routine PreventTransactionChain() that implements the
necessary tests.
Bruce Momjian [Mon, 21 Oct 2002 20:33:21 +0000 (20:33 +0000)]
When I removed the cube based stuff from eathdistance I accidentally
left a reference to cube in a comment in the regression test (that also
shows up in the expected output). This doesn't cause any real problem,
but people who read the comment might be confused. Attached is a diff to
remove the reference.
Bruce Momjian [Mon, 21 Oct 2002 20:32:33 +0000 (20:32 +0000)]
Cleanup for CLUSTERDB failure:
On Sat, Oct 19, 2002 at 12:11:32AM +0200, Peter Eisentraut wrote:
> $ ./clusterdb
> psql: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> psql: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> clusterdb: While clustering peter, the following failed:
> $
>
> This could probably handled a little more gracefully.
Yes, sorry. A patch for this is attached. Please apply.
Tom Lane [Mon, 21 Oct 2002 19:59:14 +0000 (19:59 +0000)]
Remove unnecessary (and inadequate) check of IsTransactionBlock() in
pgstat_vacuum_tabstat(). Assume that caller (namely, VACUUM) has done
the appropriate state checking beforehand.
Tom Lane [Sun, 20 Oct 2002 20:47:31 +0000 (20:47 +0000)]
Fix potential problem with btbulkdelete deleting an indexscan's current
item, if the page containing the current item is split while the indexscan
is stopped and holds no read-lock on the page. The current item might
move right onto a page that the indexscan holds no pin on. In the prior
code this would allow btbulkdelete to reach and possibly delete the item,
causing 'my bits moved right off the end of the world!' when the indexscan
finally resumes. Fix by chaining read-locks to the right during
_bt_restscan and requiring btbulkdelete to LockBufferForCleanup on every
page it scans, not only those with deletable items. Per my pghackers
message of 25-May-02. (Too bad no one could think of a better way.)
Barry Lind [Sun, 20 Oct 2002 02:55:50 +0000 (02:55 +0000)]
Applied patch from Teofilis Martisius to improve performance.
Also removed some unused files and fixed the which needed a small change
after the previous patch to build.xml.
Tom Lane [Sun, 20 Oct 2002 00:58:55 +0000 (00:58 +0000)]
Rule rewriter was doing the wrong thing with conditional INSTEAD rules
whose conditions might yield NULL. The negated qual to attach to the
original query is properly 'x IS NOT TRUE', not 'NOT x'. This fix
produces correct behavior, but we may be taking a performance hit because
the planner is much stupider about IS NOT TRUE than it is about NOT
clauses. Future TODO: teach prepqual, other parts of planner how to
cope with BooleanTest clauses more effectively.
Barry Lind [Sun, 20 Oct 2002 00:10:55 +0000 (00:10 +0000)]
Applied patch submitted by Mike Beachy to give a better error message if
configure hasn't been run before trying to build.
Also cleaned up the README file and removed some obsolete files.
Tom Lane [Sat, 19 Oct 2002 22:51:45 +0000 (22:51 +0000)]
Fix incomplete definition of ALTER TABLE ADD/DROP CONSTRAINT syntax.
Add some verbiage about recent tweaks to behavior of ADD and DROP
COLUMN when there are descendant tables.
Tom Lane [Sat, 19 Oct 2002 22:10:58 +0000 (22:10 +0000)]
Fix within-function memory leaks in the various PLs' interfaces to
SPI_prepare: they all save the prepared plan into topCxt, and so the
procCxt copy that's actually returned by SPI_prepare ought to be freed.
Diagnosis and plpython fix by Nigel Andrews, followup for other PLs
by Tom Lane.
Barry Lind [Sat, 19 Oct 2002 21:53:42 +0000 (21:53 +0000)]
Backed out part of the change from 1.6. The attempt to support int8 binds
in such a way that indexes on int8 columns would be used (by quoting the value)
caused other problems. Will need to wait for the backend to properly fix
the root problem.
Tom Lane [Sat, 19 Oct 2002 20:50:44 +0000 (20:50 +0000)]
Make psql's \df display functions that return sets as having return type
'setof something'; formerly you could not tell at all that the function
returns set.
Tom Lane [Sat, 19 Oct 2002 20:15:09 +0000 (20:15 +0000)]
Invert logic in pg_exec_query_string() so that we set a snapshot for
all utility statement types *except* a short list, per discussion a few
days ago. Add missing SetQuerySnapshot calls in VACUUM and REINDEX,
and guard against calling REINDEX DATABASE from a function (has same
problem as VACUUM).
Tom Lane [Sat, 19 Oct 2002 19:00:47 +0000 (19:00 +0000)]
Fix rewrite code so that rules are in fact executed in order by name,
rather than being reordered according to INSTEAD attribute for
implementation convenience.
Also, increase compiled-in recursion depth limit from 10 to 100 rewrite
cycles. 10 seems pretty marginal for situations where multiple rules
exist for the same query. There was a complaint about this recently,
so I'm going to bump it up. (Perhaps we should make the limit a GUC
parameter, but that's too close to being a new feature to do in beta.)
Tom Lane [Sat, 19 Oct 2002 02:56:16 +0000 (02:56 +0000)]
Fix range-query estimation to not double-exclude NULLs, per gripe from
Ray Ontko 28-June-02. Also, fix prefix_selectivity for NAME lefthand
variables (it was bogusly assuming binary compatibility), and adjust
make_greater_string() to not call pg_mbcliplen() with invalid multibyte
data (this last per bug report that I can't find at the moment, but it
was in July '02).
Bruce Momjian [Sat, 19 Oct 2002 02:16:40 +0000 (02:16 +0000)]
It includes
-Support for mirroring tables in different Schema's
-Improved documentation for compiling with 7.1.x and 7.2.x
-Fixes a buffer overrun bug.
Bruce Momjian [Sat, 19 Oct 2002 02:09:45 +0000 (02:09 +0000)]
> Huh, I don't know where I got the idea you were (or someone else was?)
> in the position that attislocal should be reset. I'll clean everything
> up and submit the patch I had originally made.
All right, this is it. This patch merely checks if child tables have
the column. If atttypid and atttypmod are the same, the attributes'
attinhcount is incremented; else the operation is aborted. If child
tables don't have the column, recursively add it.
Bruce Momjian [Sat, 19 Oct 2002 02:08:19 +0000 (02:08 +0000)]
This patch adds some missing functions for float8 math operations,
specifically ceil(), floor(), and sign(). There may be other functions
that need to be added, but this is a start. I've included some simple
regression tests.
Tom Lane [Sat, 19 Oct 2002 00:22:14 +0000 (00:22 +0000)]
Fix psql's \copy to accept table names containing schemas, as well as
a column list. Bring its parsing of quoted names and quoted strings
somewhat up to speed --- I believe it now handles all non-error cases
the same way the backend would, but weird boundary conditions are not
necessarily done the same way.
Tom Lane [Fri, 18 Oct 2002 20:44:02 +0000 (20:44 +0000)]
Fix breakage that had crept into setlocale() usage: once again we've
been bit by the fact that the locale functions return pointers to
modifiable variables. I added some comments that might help us avoid
the mistake in future.
Tom Lane [Fri, 18 Oct 2002 20:33:57 +0000 (20:33 +0000)]
Make 'dummy' declarations in header files be 'extern int no_such_variable'
instead of 'extern int errno'; the latter is unsafe according to the
ANSI C standard, as well as in practice on some platforms.
Bruce Momjian [Wed, 16 Oct 2002 03:24:09 +0000 (03:24 +0000)]
Fix script to handle autocommit = 'off' by prepending autocommit 'on' to
the start of the psql commandline. This is better than adding BEGIN/END
because it handles multiple queries well, and allows the return code for
psql to return the proper value.