Re: Trigger problem

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: mordicus <mordicus(at)free(dot)fr>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trigger problem
Date: 2001-12-06 23:14:53
Message-ID: 20011206151247.T28880-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 6 Dec 2001, mordicus wrote:

> So, if i do
>
> insert into abreviations(smot,mot,abreviation,pays) select
> smot,mot,abreviation,pays from a;
>
> the Trigger is executed for each row ONLY after all rows have been
> inserted, so the
> " id := currval(''abr_id'');"
> in my trigger have false value (always the last value after 53000 insert
> ...)

Wouldn't NEW.id give you the value you want rather than mucking with the
sequence value?

> Any way to fire a trigger really when a row is inserted ?

I don't think you can get the triggers to run such that currval would give
you what you want, but I could be wrong.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Fisher 2001-12-07 00:00:22 referential integrity on existing table
Previous Message Stephan Szabo 2001-12-06 23:09:20 Re: Database links in Postgresql.