pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: greg@antrez.pl
To: pgsql-bugs@postgresql.org
Subject: BUG #8227: referential integrity problem
Date: Wed, 12 Jun 2013 20:08:53 +0000
Message-ID: <E1UmrLh-0001y7-C0@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      8227
Logged by:          Greg Brzezinski
Email address:      greg@antrez.pl
PostgreSQL version: 9.2.4
Operating system:   linux
Description:        

postgres=# CREATE TABLE test( id int primary key, name text );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "test_pkey"
for table "test"
CREATE TABLE
postgres=# CREATE TABLE test_item( id int primary key, test_id int
references test(id)  match full on update cascade on delete cascade, content
text );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"test_item_pkey" for table "test_item"
CREATE TABLE
postgres=# CREATE OR REPLACE FUNCTION test_item_delete_lock() returns
trigger AS $f$
postgres$# begin
postgres$#     return null;
postgres$# end;
postgres$# $f$ language plpgsql;
CREATE FUNCTION
postgres=# CREATE TRIGGER test_item_delete_lock BEFORE DELETE ON test_item
FOR EACH ROW EXECUTE PROCEDURE test_item_delete_lock();
CREATE TRIGGER
postgres=#
postgres=# insert into test values (1, 'one');
INSERT 0 1
postgres=# insert into test_item values (1, 1, 'for one');
INSERT 0 1
postgres=# delete from test where id = 1;
DELETE 1
postgres=# select * from test_item;
 id | test_id | content
----+---------+---------
  1 |       1 | for one
(1 row)

postgres=# select * from test;
 id | name
----+------
(0 rows)


Is it ok that we loose referential integrity by locking DELETE on table
test_item ?



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)  latest in thread

Message-ID: <E1UmrLh-0001y7-C0@wrigleys.postgresql.org>
Permalink:  ../E1UmrLh-0001y7-C0@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1UmrLh-0001y7-C0@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: greg@antrez.pl
  Subject: Re: BUG #8227: referential integrity problem
  In-Reply-To: <E1UmrLh-0001y7-C0@wrigleys.postgresql.org>
  References: <E1UmrLh-0001y7-C0@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox