What I'm trying to do is to deny people from touching stuff they don't
'own'. I have a table which maps postgresql user-names to user-ids. Here is
a shorter version of my problem. It could be implemented differently, but
the point is that it crashes.. And only with update.

The following session crashes with 6.5.3 (with i386 debian woody, 6.5.3-13):

template1=> create database foo;
CREATEDB
template1=> \c foo
connecting to new database: foo
foo=> drop table data;
DROP
foo=> drop table users;
DROP
foo=> create table users(id int);
CREATE
foo=> create table data(owner int, data int);
CREATE
foo=> create rule data_update as on update to data where not exists (select 
1 from users where new.owner=users.id) do instead nothing;
CREATE
foo=> insert into users values(1);
INSERT 1294260 1
foo=> insert into data values(1, 5);
INSERT 1294261 1
foo=> update data set data=5 where data=5;
pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally
        before or while processing the request.
We have lost the connection to the backend, so further processing is
impossible.  Terminating.

It's the same with explain:
foo=> explain update data set data=5 where data=5;
pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally
        before or while processing the request.
We have lost the connection to the backend, so further processing is
impossible.  Terminating.

postgresql.log says:

CommitTransactionCommand
StartTransactionCommand
query: update data set data=5 where data=5;
/usr/lib/postgresql/bin/postmaster: reaping dead processes...
/usr/lib/postgresql/bin/postmaster: CleanupProc: pid 16389 exited with
status 11
/usr/lib/postgresql/bin/postmaster: CleanupProc: sending SIGUSR1 to process
16359
/usr/lib/postgresql/bin/postmaster: CleanupProc: reinitializing shared
memory and semaphores
shmem_exit(0) [#0]
binding ShmemCreate(key=52e325, size=2006016)
NOTICE:  Message from PostgreSQL backend:
        The Postmaster has informed me that some other backend died
abnormally and possibly corrupted shared memory.
        I have rolled back the current transaction and am going to terminate
your database system connection and exit.
        Please reconnect to the database system and repeat your query.

I'd be very happy if a fix for this would still reach 6.5-series. If 7.0
works and upgrading will be painless, I'll be happy with it too :).
-- 
  _____________________________________________________________________
     / __// /__ ____  __                              Erkki Seppälä\   \
    / /_ / // // /\ \/ //ircnet                Inside Informatics ry\  /
   /_/  /_/ \___/ /_/\_\@modeemi.fi        http://www.inside.org/~flux/

Reply via email to