Re: Behaviour

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Stéphane Raimbault <raimbault(dot)stephane(at)free(dot)fr>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Behaviour
Date: 2002-07-18 15:36:33
Message-ID: 20020718083514.H72400-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On 18 Jul 2002, [ISO-8859-1] Stphane Raimbault wrote:

> Hi,
>
> I have the following tables :
> CREATE TABLE tournee (
> no_tournee SERIAL PRIMARY KEY);
>
> CREATE TABLE fab_tournee (
> id SERIAL PRIMARY KEY,
> id_fab INTEGER REFERENCES fabrication ON DELETE CASCADE,
> no_tournee INTEGER REFERENCES tournee ON DELETE CASCADE);
>
> When I insert a new record into 'fab_tournee' whereas the field
> 'no_tournee' doesnt exist in 'tournee', I have this message :
>
> ERROR: <unnamed> referential integrity violation - key referenced
> from fab_tournee not found in tournee
>
> but 'id' increments in 'fab_tournee'.
>
> Is it a normal behaviour ?

Yes. SERIAL uses a sequence for doing its value choice (it's
effectively similar to an integer column with a default) and
sequences do not rollback with transactions (due to concurrency
concerns). You can find more info about this in the archives.

In response to

  • Behaviour at 2002-07-17 22:22:46 from Stéphane Raimbault

Browse pgsql-bugs by date

  From Date Subject
Next Message Mike Coleman 2002-07-18 20:12:20 pg_ctl failure with older Bourne shells (use ${1:+"$@"})
Previous Message Tony Griffiths 2002-07-18 12:14:36 Bug found in psql interface