failed Delete after Insert in a transaction - Mailing list pgsql-general

From Andrew Snow
Subject failed Delete after Insert in a transaction
Date
Msg-id NHEALMDKDACEIPBNOOOCGEFHCIAA.als@fl.net.au
Whole thread Raw
Responses Re: failed Delete after Insert in a transaction  (JanWieck@t-online.de (Jan Wieck))
List pgsql-general
Why won't PostgreSQL let me do this?

db=# begin;
BEGIN
db=# insert into foo (name) values ('hmmm');
INSERT 22288 1
db=# delete from foo where name='hmmm';
ERROR:  triggered data change violation on relation "foo"
db=# abort;

The table foo is defined like this:

CREATE TABLE foo (
  ID    serial PRIMARY KEY,
  Name  text NOT NULL
  );


I can't work out what I am doing wrong!


Note, there is another table that REFERENCES this table, but as you can see
in the example transaction above, I don't touch any other tables.  Also note
that it works fine outside of a transaction.

I am running postgresql 7.02 on FreeBSD 3.4-STABLE.


Thanks


Andrew




pgsql-general by date:

Previous
From: "Manuel Lemos"
Date:
Subject: Re: Can't put sub-queries values in queries results?
Next
From: "Alex Bolenok"
Date:
Subject: Re: failed Delete after Insert in a transaction