Search Postgresql Archives

Re: target list evaluation wrt sequences

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 24, 2004 at 16:03:24 -0700,
  elein <elein@varlena.com> wrote:
> 
> I have an insert using a select of sequences.
> 
> insert into ...
> 	select
> 		nextval('n') as a,
> 		currval('n') as b,
> 		...
> 	from lalala
> ;
> 
> Is the order of the target list guaranteed?
> That is, will the a and b in the above selection
> *always* be the same?  

No. You can do effectively this by joining a select nextval to whatever
you main select is. Something like:
insert into ...
       select a.n as a, a.n as b, ....
             from (select nextval('n') as n) as a, lalala

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux