Problem with transaction - Mailing list pgsql-general

From Alexander Haväng
Subject Problem with transaction
Date
Msg-id 20001117114039.C30658@ljudo.shortlist.se
Whole thread Raw
List pgsql-general
Hi :)

I'm kinda new with SQL, and kinda new with postgres, but I'm having trouble
with a simple transaction that works just fine on Informix so it should
work here on postgres too unless I'm messing it up somehow.

This is my table
CREATE TABLE hosts (
       hid SERIAL PRIMARY KEY,
       name VARCHAR(40) NOT NULL UNIQUE,
       hostname VARCHAR(255) NOT NULL
);

This is my psql session:
filterlogic=> begin;
BEGIN
filterlogic=> insert into hosts (name, hostname) VALUES ('sun', 'www.sun.com');
INSERT 403520 1
filterlogic=> delete from hosts where name='sun';
ERROR:  triggered data change violation on relation "hosts"
ERROR:  triggered data change violation on relation "hosts"

If I do a commit before the delete, it works just fine.
Why is this, and what can I do to get around this?

Regards,
Eel

pgsql-general by date:

Previous
From: Alexey Borzov
Date:
Subject: Re[2]: [HACKERS] Re: PHPBuilder article -- Postgres vs MySQL
Next
From: Alexander Jerusalem
Date:
Subject: Re: I know installation questions are boring ...