currval() within one statement

From: silly_sad <sad(at)bankir(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject: currval() within one statement
Date: 2008-01-22 07:16:30
Message-ID: 4795984E.7030904@bankir.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Helo

is it expected that the currval() changes its value between calls within
one statement ?

Look the following call:

INSERT INTO ttt (a,b) SELECT currval('ttt_id_seq'), 'const' FROM ttt2;

Where the trigger before insert on ttt is defined and this trigger calls
nextval('ttt_id_seq').

I was surprised having different values of currval() in ttt.a

Is this the normal behavior ? Where is it described ?

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2008-01-22 07:36:37 Re: currval() within one statement
Previous Message Steve Midgley 2008-01-22 05:21:20 Re: improvements to query with hierarchical elements