Hi,
I have a question on the right/correct practice on using the serial col's
sequence for insert.
Best way of explanation is by an example:
create table id01 (col1 serial, col2 varchar(10));
insert into id01(col2) values ( 'data'||currval('id01_col1_seq')::varchar);
while I do get what I want:
select * from id01;
col1 | col2
------+-------
1 | data1
Is this guaranteed to work : I am assuming that an insert triggers the
id01_col1_seq's nextval first hence using
id01_col1_seq's currval subsequently will have the "correct" / expected
value (and not the previous value before the insert).
Is my assumption correct?
Thanks in advance,
AK