Tom Lane [Tue, 23 Sep 2003 23:31:52 +0000 (23:31 +0000)]
Issue CREATE SCHEMA as the originally connecting user, with an
AUTHORIZATION clause to specify the desired owner. This allows a
superuser to restore schemas owned by users without CREATE-SCHEMA
permissions (ie, schemas originally created by a superuser using
AUTHORIZATION). --no-owner can be specified to suppress the
AUTHORIZATION clause if need be.
Tom Lane [Tue, 23 Sep 2003 22:48:53 +0000 (22:48 +0000)]
pg_dump/pg_restore now always use SET SESSION AUTHORIZATION, not \connect,
to control object ownership. The use-set-session-authorization and
no-reconnect switches are obsolete (still accepted on the command line,
but they don't do anything). This is a precursor to fixing handling
of CREATE SCHEMA, which will be a separate commit.
Tom Lane [Tue, 23 Sep 2003 17:12:53 +0000 (17:12 +0000)]
Tweak generic_type_consistency routines to avoid loss of functionality
since 7.3: 'select array_dims(histogram_bounds) from pg_stats' used to
work and still should. Problem was that code wouldn't take input of
declared type anyarray as matching an anyarray argument. Allow this
case as long as we don't need to determine an element type (which in
practice means as long as anyelement isn't used in the function signature).
Barry Lind [Tue, 23 Sep 2003 06:13:52 +0000 (06:13 +0000)]
Fix to properly handle timezone offsets that are partial hours. If the offset
was a partial hour and less than gmt (i.e. -02:30) the code would corrupt the
minutes part.
fix hlfinditem function. Thanks to "Stphane Bidoul" <stephane.bidoul@softwareag.com>.
The 'word' variable there is initialised from
the prs->words array, but immediately after,
that array may be reallocated, thus leaving
word pointing to unallocated memory.
Tom Lane [Mon, 22 Sep 2003 00:47:23 +0000 (00:47 +0000)]
HeapTupleSatisfiesVacuum() needs to be more careful about the
difference between INSERT_IN_PROGRESS and DELETE_IN_PROGRESS for
tuples inserted and then deleted by a concurrent transaction.
Example of bug:
regression=# create table foo (f1 int);
CREATE TABLE
regression=# begin;
BEGIN
regression=# insert into foo values(1);
INSERT 195531 1
regression=# delete from foo;
DELETE 1
regression=# insert into foo values(1);
INSERT 195532 1
regression=# create unique index fooi on foo(f1);
ERROR: could not create unique index
DETAIL: Table contains duplicated values.
Tom Lane [Sun, 21 Sep 2003 17:57:21 +0000 (17:57 +0000)]
Arrange to align shared disk buffers on at least 32-byte boundaries,
not just MAXALIGN boundaries. This makes a noticeable difference in
the speed of transfers to and from kernel space, at least on recent
Pentiums, and might help other CPUs too. We should look at making
this happen for local buffers and buffile.c too. Patch from Manfred Spraul.
Tom Lane [Fri, 19 Sep 2003 21:04:20 +0000 (21:04 +0000)]
Disallow foreign-key references from temp tables to permanent tables.
Per recent discussion, this does not work because other backends can't
reliably see tuples in a temp table and so cannot run the RI checks
correctly. Seems better to disallow this case than go back to accessing
temp tables through shared buffers. Also, disallow FK references to
ON COMMIT DELETE ROWS tables. We already caught this problem for normal
TRUNCATE, but the path used by ON COMMIT didn't check.
Tom Lane [Fri, 19 Sep 2003 20:47:59 +0000 (20:47 +0000)]
Latest version of gcc from Apple does not work well with -traditional-cpp
(it rejects some system header files...). Use -no-cpp-precomp instead.
I think it is okay to change this unconditionally, but if we hear
complaints from people still using very old compilers on Darwin,
we could put in a test to see which switch the compiler likes.
Tom Lane [Fri, 19 Sep 2003 19:57:42 +0000 (19:57 +0000)]
Seems like a bad idea that REINDEX TABLE supports (or thinks it does)
reindexing system tables without ignoring system indexes, when the
other two varieties of REINDEX disallow it. Make all three act the same,
and simplify downstream code accordingly.
Michael Meskes [Thu, 18 Sep 2003 13:12:23 +0000 (13:12 +0000)]
- Accept output variables for FETCH in DECLARE statement.
- Synced parser.
- Allowed C variables to carry the name of prepared statements.
- Added Informix handling of datatype converion errors.
Tom Lane [Wed, 17 Sep 2003 17:19:17 +0000 (17:19 +0000)]
Disallow converting a table to a view if it has triggers, indexes, or
child tables --- all cases that will trip various sanity checks elsewhere
in the system, as well as cases that should not occur in the only intended
use of this feature, namely coping with ancient pg_dump representation
of views. Per bug report from Chris Pizzi.
Tom Lane [Mon, 15 Sep 2003 23:33:43 +0000 (23:33 +0000)]
Fix LISTEN/NOTIFY race condition reported by Gavin Sherry. While a
really general fix might be difficult, I believe the only case where
AtCommit_Notify could see an uncommitted tuple is where the other guy
has just unlistened and not yet committed. The best solution seems to
be to just skip updating that tuple, on the assumption that the other
guy does not want to hear about the notification anyway. This is not
perfect --- if the other guy rolls back his unlisten instead of committing,
then he really should have gotten this notify. But to do that, we'd have
to wait to see if he commits or not, or make UNLISTEN hold exclusive lock
on pg_listener until commit. Either of these answers is deadlock-prone,
not to mention horrible for interactive performance. Do it this way
for now. (What happened to that project to do LISTEN/NOTIFY in memory
with no table, anyway?)
Peter Eisentraut [Sun, 14 Sep 2003 22:40:38 +0000 (22:40 +0000)]
Run distprep target before creating list of files that contain translatable
strings in the backend, so that .l and .y files are included. To that end,
don't make the .pot file a prerequisite on distprep.
Tom Lane [Sun, 14 Sep 2003 18:44:23 +0000 (18:44 +0000)]
Persuade tsearch/tsearch2 to work (or at least pass their regression
tests) when using flex 2.5.31. The fix is to *not* try to use palloc
and pfree for allocations within the lexer; when you do that, the
yy_buffer_stack gets freed at inopportune times. The code is already
set up to do manual deallocation, so I see no particular advantage to
using palloc anyway.
Tom Lane [Sun, 14 Sep 2003 17:25:54 +0000 (17:25 +0000)]
Make pltcl create separate function objects when the same function is
used as trigger on different relations. I am not convinced that Tcl
actually has to have this, but it seems a good idea to make it be
parallel to the other PLs that definitely do need it.
Tom Lane [Sun, 14 Sep 2003 17:13:06 +0000 (17:13 +0000)]
Fix plpython to generate separate cached procedure data for each
relation, when the same function is used as a trigger on more than
one relation. This avoids crashes due to differing rowtypes for
different relations. Per bug report from Lance Thomas, 7-Feb-03.
Tom Lane [Sat, 13 Sep 2003 22:25:38 +0000 (22:25 +0000)]
Avoid corner cases where aset.c would unnecessarily make malloc()
requests of sizes that aren't powers of 2. Per observation from
David Schultz, 28-Aug.
Tom Lane [Sat, 13 Sep 2003 21:44:50 +0000 (21:44 +0000)]
With Joe Conway's concurrence, remove srandom() call from normal_rand().
This was the last piece of code that took it upon itself to reset the
random number sequence --- now we only have srandom() in postmaster start,
backend start, and explicit setseed() operations.
Tom Lane [Sat, 13 Sep 2003 21:12:38 +0000 (21:12 +0000)]
Okay, I've had it with mktime() bugs. While chasing Torello Querci's
recent gripe, I discovered not one but two undocumented, undesirable
behaviors of glibc's mktime. So, stop using it entirely, and always
rely on inversion of localtime() to determine the local time zone.
It's not even very much slower, as it turns out that mktime (at least
in the glibc implementation) also does repeated reverse-conversions.
Bruce Momjian [Sat, 13 Sep 2003 16:44:49 +0000 (16:44 +0000)]
With pg_autovacuum becoming increasingly popular it's important to
have a working stats collector. This test is able to discover the
problem that was present in 7.4 Beta 2.
Bruce Momjian [Sat, 13 Sep 2003 16:43:38 +0000 (16:43 +0000)]
When I sent in the sslmode patch I forgot to update the
comments/examples in pg_hba.conf. This patch remedies that, adds a brief
explanation of the connection types, and adds a missing period in the
docs.
Bruce Momjian [Sat, 13 Sep 2003 16:26:18 +0000 (16:26 +0000)]
> OK, well as we wait on the fix for the stats system, let me submit my
> patch for pg_autovacuum. This patch assumes that the stats system will
> be fixed so that all inserts, updates and deletes performed on shared
> tables reguardless of what database those commands were executed from,
> will show up in the stats shown in each database.
I had to make a further change to this to take quotes off the 'last
ANALYZE' in order for it to not overquote the relation name, so
there's a _little_ work left to get it to play well.
I have deployed it onto several boxes that should be doing some
vacuuming over the weekend, and it is now certainly hitting pg_
tables.
I would like to present a CVS-oriented patch; unfortunately, I had to
change the indentation patterns when editing some of it :-(. The
following _may_ be good; not sure...
Bruce Momjian [Sat, 13 Sep 2003 14:49:51 +0000 (14:49 +0000)]
Attempt threading in this order:
* use non-*_r function names if they are all thread-safe
* (NEED_REENTRANT_FUNCS=no)
* use *_r functions if they exist (configure test)
* do our own locking and copying of non-threadsafe functions
Tom Lane [Fri, 12 Sep 2003 20:18:51 +0000 (20:18 +0000)]
Revert to our pre-7.4 behavior of identifying Unix-socket connections in
ps status as '[local]', not as 'localhost' as the code has been doing
recently. That's too easily confused with TCP loopback connections,
and there is no good reason to change the behavior anyway.
Tom Lane [Fri, 12 Sep 2003 19:33:59 +0000 (19:33 +0000)]
Someone (possibly me) foolishly reduced the response for failing
to create a TCP/IP socket from FATAL to LOG. This was unwise;
historically we have expected socket conflicts to abort postmaster
startup. Conflicts on port numbers with another postmaster can only
be detected reliably at the TCP socket level.