Re: Alias of VALUES RTE in explain plan - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Alias of VALUES RTE in explain plan
Date
Msg-id 3037675.1729884114@sss.pgh.pa.us
Whole thread Raw
In response to Re: Alias of VALUES RTE in explain plan  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Alias of VALUES RTE in explain plan
List pgsql-hackers
I wrote:
> However ... I don't like this implementation, not even a little
> bit.

I forgot to mention a third problem, which is that reassigning the
alias during subquery pullup means it doesn't happen if subquery
pullup doesn't happen.  As an example, with your patch:

regression=# explain verbose select * from (values (1), (2)) v(x);
                     QUERY PLAN                     
----------------------------------------------------
 Values Scan on v  (cost=0.00..0.03 rows=2 width=4)
   Output: v.x
(2 rows)

regression=# explain verbose select * from (values (1), (random())) v(x);
                         QUERY PLAN                          
-------------------------------------------------------------
 Values Scan on "*VALUES*"  (cost=0.00..0.03 rows=2 width=8)
   Output: "*VALUES*".column1
(2 rows)

That's because the volatile function prevents subquery flattening.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Sergey Sargsyan
Date:
Subject: Re: CREATE INDEX CONCURRENTLY on partitioned index
Next
From: "Tristan Partin"
Date:
Subject: Re: cpluspluscheck complains about use of register