From: | Bertrand Petit <pgsql-sql(at)phoe(dot)frmug(dot)org> |
---|---|
To: | cristi <cristi(at)dmhi(dot)ct(dot)ro> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: sequence |
Date: | 2003-08-15 10:30:26 |
Message-ID: | 20030815123026.A8364@memo.frmug.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Fri, Aug 15, 2003 at 12:32:36PM +0300, cristi wrote:
> What is wrong here?
>
> insert into table_name (field_name) values (select
> setval('sequence_name')-1) as currval);
This should be better:
INSERT INTO table_name (field_name) VALUES (nextval('sequence_name'));
--
%!PS
297.6 420.9 translate 90 rotate 0 setgray gsave 0 1 1{pop 0 180 moveto 100
180 170 100 170 -10 curveto 180 -9 180 -9 190 -10 curveto 190 100 100 180
0 180 curveto fill 180 rotate}for grestore/Bookman-LightItalic findfont
240 scalefont setfont -151.536392 -63.7998886 moveto (bp)show showpage
From | Date | Subject | |
---|---|---|---|
Next Message | Dennis Björklund | 2003-08-15 10:40:28 | Re: sequence |
Previous Message | cristi | 2003-08-15 09:32:36 | sequence |