Re: problem with volatile functions in subselects ?

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Sergey E(dot) Koposov" <math(at)sai(dot)msu(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: problem with volatile functions in subselects ?
Date: 2006-08-06 19:50:21
Message-ID: c2d9e70e0608061250s3f7ee057r7dff5b5d2220dbf9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 7/30/06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Sergey E. Koposov" <math(at)sai(dot)msu(dot)ru> writes:
> > I see the very strange behaviour with the following set of queries:
>
> > wsdb=# select na,nb, na::double precision as da, nb::double precision as db from ( select random()::numeric as na,random()::numeric as nb from generate_series(1,2)) as xx;
>
> The planner "flattens" this query to a single level of SELECT, so what
> you effectively have is
>
> select random()::numeric as na,
> random()::numeric as nb,
> random()::numeric::double precision as da,
> random()::numeric::double precision as db
> from generate_series(1,2) as xx;
>
> There's been some talk about prohibiting flattening if there are any
> volatile functions in the subselect's targetlist, but nothing's been
> done about that. Disabling flattening is a sufficiently big hit to
> the planner's optimization ability that it shouldn't be done lightly.
>
> regards, tom lane
>

http://archives.postgresql.org/pgsql-hackers/2005-10/msg00396.php

maybe a guc?

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-08-06 21:29:12 Re: Intermittent "make check" failures on hyena
Previous Message Tom Lane 2006-08-06 16:47:14 Re: Intermittent "make check" failures on hyena