Tom Lane [Mon, 2 Sep 2002 23:41:17 +0000 (23:41 +0000)]
Partial solution for 'unexpected EOF' problem with pg_disconnect: it
seems we have a choice between annoying messages and leaking memory
(or dumping core, but that's right out). Patch also fixes several
other problems in pg_disconnect, such as being willing to close a
channel that isn't a PG channel.
Tom Lane [Mon, 2 Sep 2002 21:51:47 +0000 (21:51 +0000)]
pg_on_connection_loss command for libpgtcl. Patch from
Gerhard Hintermayer, revised and documented by Tom Lane.
This patch also fixes a 'must fix' bug: libpgtcl's LISTEN/NOTIFY
support was broken by the recent changes to the PGnotify structure.
Guess that change wasn't quite so safe as we thought.
Tom Lane [Mon, 2 Sep 2002 20:04:40 +0000 (20:04 +0000)]
Department of second thoughts: make checks for replacing a view slightly
more flexible, and improve the error reporting. Also, add documentation
for REPLACE RULE/VIEW.
Bruce Momjian [Mon, 2 Sep 2002 16:21:30 +0000 (16:21 +0000)]
Updated from Tom:
< o -ALTER TABLE ALTER COLUMN SET/DROP NOT NULL (Christopher Kings-Lynne)
< o ALTER TABLE ADD COLUMN column SERIAL doesn't create sequence
> o -ALTER TABLE ALTER COLUMN SET/DROP NOT NULL (Christopher) 200a200,201
> o ALTER TABLE ADD COLUMN column SERIAL doesn't create sequence because
> of the item above 232c233
< o -Disallow missing columns in INSERT ... VALUES, per ANSI
> o -Disallow missing columns in INSERT ... (col) VALUES, per ANSI
335,336d335
< * Have SERIAL generate non-colliding sequence names when we have
< auto-destruction
Bruce Momjian [Mon, 2 Sep 2002 15:30:50 +0000 (15:30 +0000)]
Updates from Tom:
< * Allow logging of query durations
> * -Allow logging of query durations
51,52d50
< * Make single-user local access permissions the default by limiting
< permissions on the socket file (Peter E)
72,73c70,71
< * Reserve last few process slots for super-user if max_connections reached
< * Add GUC parameter to print queries that generate errors
> * -Reserve last few process slots for super-user if max_connections reached
> * -Add GUC parameter to print queries that generate errors
82,83c80,81
< * Declare typein/out functions in pg_proc with a special "C string" data type
< * Functions returning sets do not totally work
> * -Declare typein/out functions in pg_proc with a special "C string" data type
> * -Functions returning sets do not totally work
90c88
< * Allow bytea to handle LIKE with non-TEXT patterns
> * -Allow bytea to handle LIKE with non-TEXT patterns
94c92
< o Store binary-compatible type information in the system
> o -Store binary-compatible type information in the system
97d94
< o -SELECT col FROM tab WHERE numeric_col = 10.1 fails, requires quotes
102c99
< o Ensure we have array-eq operators for every built-in array type
> o -Ensure we have array-eq operators for every built-in array type 119d115
< * Allow setting database character set without multibyte enabled 152d147
< * Have UPDATE/DELETE clean out indexes
198,199d192
< o ALTER TABLE ADD COLUMN to inherited table put column in wrong place
< [inheritance] 201d193
< o Add ALTER FUNCTION
203,204c195,196
< o -ALTER TABLE ADD PRIMARY KEY (Tom)
< o -ALTER TABLE ADD UNIQUE (Tom)
> o -ALTER TABLE ADD PRIMARY KEY (Christopher)
> o -ALTER TABLE ADD UNIQUE (Christopher) 248c240
< o -Remove SET KSQO option now that OR processing is improved (Tom)
> o -Remove SET KSQO option now that OR processing is improved (Bruce) 280c272
< * Have pg_dump use LEFT OUTER JOIN in multi-table SELECTs
> * -Have pg_dump use LEFT OUTER JOIN in multi-table SELECTs 287d278
< * Add config file check for $ODBCINI, $HOME/.odbc.ini, installpath/etc/odbc.ini
318,322d308
< * ODBC
< o ODBC 3.0 support
< o Unicode(UCS-2) support
< o Updatable cursors support
< 337c323
< * Fix foreign key constraints to not error on intermediate db states (Stephan)
> * -Fix foreign key constraints to not error on intermediate db states (Stephan) 352c338
< * Propagate column or table renaming to foreign key constraints
> * -Propagate column or table renaming to foreign key constraints 447c433
< * Remove wal_files postgresql.conf option because WAL files are now recycled
> * -Remove wal_files postgresql.conf option because WAL files are now recycled 460c446
< * Improve dynamic memory allocation by introducing tuple-context memory
> * -Improve dynamic memory allocation by introducing tuple-context memory 463c449
< * Nested FULL OUTER JOINs don't work (Tom)
> * -Nested FULL OUTER JOINs don't work (Tom)
Bruce Momjian [Mon, 2 Sep 2002 06:44:22 +0000 (06:44 +0000)]
Done:
> * -Add OR REPLACE clauses to non-FUNCTION object creation
> * -Allow autocommit so always in a transaction block
> * -Cache most recent query plan(s) (Neil) [prepare]
Bruce Momjian [Mon, 2 Sep 2002 06:22:20 +0000 (06:22 +0000)]
> Okay. When you get back to the original issue, the gold is hidden in
> src/backend/optimizer/path/indxpath.c; see the "special indexable
> operators" stuff near the bottom of that file. (It's a bit of a crock
> that this code is hardwired there, and not somehow accessed through a
> system catalog, but it's what we've got at the moment.)
The attached patch re-enables a bytea right hand argument (as compared
to a text right hand argument), and enables index usage, for bytea LIKE
Bruce Momjian [Mon, 2 Sep 2002 06:20:53 +0000 (06:20 +0000)]
This patch fixes a minor inaccuracy in the documentation: NOT NULL is
not synonymous with CHECK (xxx IS NOT NULL) -- for example, consider
ALTER TABLE ADD PRIMARY KEY, which checks for 'NOT NULL', not a check
constraint.
Bruce Momjian [Mon, 2 Sep 2002 06:13:31 +0000 (06:13 +0000)]
Attached is a fairly sizeable update to contrib/dblink. I'd love to get
review/feedback if anyone is interested and can spend the time. But I'd
also love to get this committed and address changes as incremental
patches ;-), so if there are no objections, please apply.
Below I'll give a synopsis of the changes. More detailed descriptions
are now in a new doc directory under contrib/dblink. There is also a new
dblink.test.sql file which will give a pretty good overview of the
functions and their use.
Bruce Momjian [Mon, 2 Sep 2002 06:11:43 +0000 (06:11 +0000)]
I checked all the previous string handling errors and most of them were
already fixed by You. However there were a few left and attached patch
should fix the rest of them.
I used StringInfo only in 2 places and both of them are inside debug
ifdefs. Only performance penalty will come from using strlen() like all
the other code does.
I also modified some of the already patched parts by changing
snprintf(buf, 2 * BUFSIZE, ... style lines to
snprintf(buf, sizeof(buf), ... where buf is an array.
Bruce Momjian [Mon, 2 Sep 2002 05:55:43 +0000 (05:55 +0000)]
Okay, attached is a patch that moves the alter table regression test
into a separate parallel group. I can't confirm that this fixes the
problem for me (since it only occurs about one in ten or one in twenty
runs), but I think it's a good bet that it does...
Bruce Momjian [Mon, 2 Sep 2002 05:53:23 +0000 (05:53 +0000)]
Here's a doc patch for the new string functions recently committed --
replace, split, and to_hex. The patch also moves encode and decode into
alphabetical order (since everything else in the table was).
Bruce Momjian [Mon, 2 Sep 2002 05:44:05 +0000 (05:44 +0000)]
Attached is an update to contrib/tablefunc. It introduces a new
function, connectby(), which can serve as a reference implementation for
the changes made in the last few days -- namely the ability of a
function to return an entire tuplestore, and the ability of a function
to make use of the query provided "expected" tuple description.
Description:
connectby(text relname, text keyid_fld, text parent_keyid_fld,
text start_with, int max_depth [, text branch_delim])
- returns keyid, parent_keyid, level, and an optional branch string
- requires anonymous composite type syntax in the FROM clause. See
the instructions in the documentation below.
Bruce Momjian [Mon, 2 Sep 2002 04:42:52 +0000 (04:42 +0000)]
I tried to build PostgreSQL with the following step to see backends hung
during the regression test. The problem has been reproduced on two machine
but both of these are the same type of hardware and software. I also tried
to recreate the problem on other machines, on older version of AIX but I
couldn't.
After looked through pgsql-hackers mailing list, I focused on spin lock
issue to solve the problem. The easiest and may not be the best solution
for the problem is to give up HAS_TEST_AND_SET. This actually works.
One another and better solution for the problem is to use _check_lock() and
_clear_lock() as spin lock. Important thing here is to define S_UNLOCK()
with _clear_lock(). This will solve the so called "Compiler bug" issue
someone wrote on the mailing list.
We have some other API such as cs(), compare_and_swap() and fetch_and_or()
to do test and set on AIX, but any of these didn't solve my problem. I
wrote tiny testing program to see if we have any bug of these API of AIX,
but I couldn't see any problem except for compare_and_swap(). It seems that
you can not use compare_and_swap() for the purpose, as it would not work as
spin lock on any SMP machines I tested. I don't know the reason why cs()
nor fetch_and_or()/fetch_and_and() will not work with PostgreSQL on p690.
These worked with my testing program on all machines I tested.
Barry Lind [Mon, 2 Sep 2002 03:07:36 +0000 (03:07 +0000)]
JDBC checkin fixing the following bugs:
Fixed support in the driver for notifications (added PGConnection.getNotifications()) - problem reported by Benjamin.Feinstein@guardent.com
Worked around server problems with int8/int2 and constants; quote values when they are intended to bind to an int8/int2 column - reported by many
Fixed bug in the Array interface with string parsing not handling escaped characters correctly - reported by devajx@yahoo.com
Added workaround to support 'infinity' and '-infinity' for dates - reported bydmitry@openratings.com
Fixed some performance issues with setBlob - reported by d.wall@computer.org
Added support for using new prepared statements functionality in 7.3 (added PGStatement.setUseServerPrepare() and isUseServerPrepare() methods)
Tom Lane [Mon, 2 Sep 2002 01:05:06 +0000 (01:05 +0000)]
Code review for HeapTupleHeader changes. Add version number to page headers
(overlaying low byte of page size) and add HEAP_HASOID bit to t_infomask,
per earlier discussion. Simplify scheme for overlaying fields in tuple
header (no need for cmax to live in more than one place). Don't try to
clear infomask status bits in tqual.c --- not safe to do it there. Don't
try to force output table of a SELECT INTO to have OIDs, either. Get rid
of unnecessarily complex three-state scheme for TupleDesc.tdhasoids, which
has already caused one recent failure. Improve documentation.
Tom Lane [Sun, 1 Sep 2002 00:58:07 +0000 (00:58 +0000)]
Mark the float8 -> int8 cast as implicit. This resolves the problem
pointed out by Barry Lind: UPDATE bigintcol = 10000000000 fails because
the constant is initially taken as float8. We really need a better way,
but it's not gonna happen for 7.3.
Also, remove int4reltime() function, which is redundant with the
existing binary-compatibility coercion path from int4 to reltime,
and probably has been unreachable code for a long while.
Tom Lane [Sat, 31 Aug 2002 22:10:48 +0000 (22:10 +0000)]
Code review for domain-constraints patch. Use a new ConstraintTest node
type for runtime constraint checks, instead of misusing the parse-time
Constraint node for the purpose. Fix some damage introduced into type
coercion logic; in particular ensure that a coerced expression tree will
read out the correct result type when inspected (patch had broken some
RelabelType cases). Enforce domain NOT NULL constraints against columns
that are omitted from an INSERT.
Tom Lane [Sat, 31 Aug 2002 17:14:28 +0000 (17:14 +0000)]
Code review for pg_locks feature. Make shmemoffset of PROCLOCK structs
available (else there's no way to interpret the list links). Change
pg_locks view to show transaction ID locks separately from ordinary
relation locks. Avoid showing N duplicate rows when the same lock is
held multiple times (seems unlikely that users care about exact hold
count). Improve documentation.
Tom Lane [Fri, 30 Aug 2002 23:59:46 +0000 (23:59 +0000)]
Add expected tuple descriptor to ReturnSetInfo information for table
functions, per suggestion from John Gray and Joe Conway. Also, fix
plpgsql RETURN NEXT to verify that returned values match the expected
tupdesc.
Tom Lane [Fri, 30 Aug 2002 22:18:07 +0000 (22:18 +0000)]
AUTOCOMMIT mode is now an available backend GUC variable; setting it
to false provides more SQL-spec-compliant behavior than we had before.
I am not sure that setting it false is actually a good idea yet; there
is a lot of client-side code that will probably be broken by turning
autocommit off. But it's a start.
Tom Lane [Fri, 30 Aug 2002 19:23:20 +0000 (19:23 +0000)]
Add attisinherited column to pg_attribute; use it to guard against
column additions, deletions, and renames that would let a child table
get out of sync with its parent. Patch by Alvaro Herrera, with some
kibitzing by Tom Lane.
Tom Lane [Fri, 30 Aug 2002 02:01:34 +0000 (02:01 +0000)]
Revert _LARGEFILE64_SOURCE addition; good try but doesn't work,
at least not on HPUX 10.20, and there's no reason to think it
is needed on later versions.
Tom Lane [Fri, 30 Aug 2002 00:28:41 +0000 (00:28 +0000)]
PL/pgSQL functions can return sets. Neil Conway's patch, modified so
that the functionality is available to anyone via ReturnSetInfo, rather
than hard-wiring it to PL/pgSQL.
Bruce Momjian [Thu, 29 Aug 2002 23:06:32 +0000 (23:06 +0000)]
> > > > If you want to put in security restrictions that are actually useful,
> > > > where is the code to verify that PGPASSWORDFILE points at a
> > > > non-world-readable file? That needs to be there now, not later, or
> > > > we'll have people moaning about backward compatibility when we finally
> > > > do plug that hole.
Bruce Momjian [Thu, 29 Aug 2002 23:05:44 +0000 (23:05 +0000)]
Sir Mordred The Traitor <mordred@s-mail.com> writes:
> Upon invoking a polygon(integer, circle) function a
> src/backend/utils/adt/geo_ops.c:circle_poly() function will gets
> called, which suffers from a buffer overflow.
>
> 2) A src/backend/adt/utils/geo_ops.c:path_encode() fails to detect a
> buffer overrun condition. It is called in multiple places, the most
> interesting are path_out() and poly_out() functions.
> 5) A src/backend/utils/adt/geo_ops.c:path_add() also fails to detect
> a simple buffer overrun.
I've attached a patch which should fix these problems.
Bruce Momjian [Thu, 29 Aug 2002 23:03:58 +0000 (23:03 +0000)]
The changes I have made are described in CHANGES. This was based on
diffs to 7.3-devel and may not be applicable to 7.2. I have included a
change covered by a previous bugfix patch I submitted (the problem with
-.1 not being accepted by cube_in). It does not include a fix for the
potential buffer overrun issue I reported for cube_yyerror in
cubeparse.y.
Bruce Momjian [Thu, 29 Aug 2002 21:02:12 +0000 (21:02 +0000)]
This patch reserves the last superuser_reserved_connections slots for
connections by the superuser only.
This patch replaces the last patch I sent a couple of days ago.
It closes a connection that has not been authorised by a superuser if it would
leave less than the GUC variable ReservedBackends
(superuser_reserved_connections in postgres.conf) backend process slots free
in the SISeg. This differs to the first patch which only reserved the last
ReservedBackends slots in the procState array. This has made the free slot
test more expensive due to the use of a lock.
After thinking about a comment on the first patch I've also made it a fatal
error if the number of reserved slots is not less than the maximum number of
connections.