Search Postgresql Archives

Re: target list evaluation wrt sequences

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

 



On Fri, Apr 30, 2004 at 01:01:25 -0400,
  Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Bruno Wolff III <bruno@wolff.to> writes:
> > 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
> 
> Urgh ... I'd not want to promise that nextval() will always be evaluated
> just once in the above example ... this really seems *much* more fragile
> than assuming left-to-right targetlist evaluation :-(
> 

Thanks for the heads up. I have so far only used that technique to speed up
some queries with respect to using subselects, where the subquery would
always evaluate to the same value anyway.
If I need a single value from a volatile calculation to be used more than
once, I will remember to use a separate query to save the value in a table and
then refer to that value later.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.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