Re: ORDER BY vs. volatile functions - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: ORDER BY vs. volatile functions
Date
Msg-id 87my2mgy4s.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: ORDER BY vs. volatile functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ORDER BY vs. volatile functions
List pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>> For bonus weirdness:
>> select distinct random(),random() from generate_series(1,10);>> set enable_hashagg=off;>> select distinct
random(),random()from generate_series(1,10);
 
>> I think _that_ one is a bug.
Tom> Hmm.  I think the first one is a bug --- the two invocations ofTom> random() in the tlist shouldn't be folded
together.

That's what I meant.

If you try it using nextval(), you'll notice that the function does
in fact get called twice per row, but one of the results is thrown
away and replaced with the other one.

-- 
Andrew.


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: next CommitFest
Next
From: Tom Lane
Date:
Subject: Re: ORDER BY vs. volatile functions