This crashes, apparently it tries to look up the result type on a NULL
planstate:

with recursive  z(i) as (
    select * 
      from t 
     union all 
      (with a(i) as (select  * from z) 
    select * from a)
    )
 select * from z;

Incidentally, why are the parentheses required around the second branch of the
union?

#0  0x081b0d39 in ExecGetResultType (planstate=0x0) at execUtils.c:535
#1  0x081becfe in ExecInitWorkTableScan (node=0x851fc08, estate=0x8523220, 
    eflags=0) at nodeWorktablescan.c:140
#2  0x081a6698 in ExecInitNode (node=0x851fc08, estate=0x8523220, eflags=0)
    at execProcnode.c:218
#3  0x081a3569 in InitPlan (queryDesc=0x8522e18, eflags=0) at execMain.c:676
#4  0x081a2cd4 in ExecutorStart (queryDesc=0x8522e18, eflags=0)
    at execMain.c:202
#5  0x0826e74e in PortalStart (portal=0x851ae00, params=0x0, snapshot=0x0)
    at pquery.c:528
#6  0x08269529 in exec_simple_query (
    query_string=0x8516df0 "with recursive  z(i)  as (select * from t union all 
(with a(i) as (select  * from z) select * from a)) select * from z;")
    at postgres.c:955
#7  0x0826d384 in PostgresMain (argc=4, argv=0x84878a8, 
    username=0x8487880 "stark") at postgres.c:3569
#8  0x08238a67 in BackendRun (port=0x84a24c0) at postmaster.c:3258
#9  0x08237fa2 in BackendStartup (port=0x84a24c0) at postmaster.c:2872
#10 0x082358e4 in ServerLoop () at postmaster.c:1283
#11 0x0823524e in PostmasterMain (argc=3, argv=0x8484428) at postmaster.c:1031
#12 0x081cfa89 in main (argc=3, argv=0x8484428) at main.c:188





-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's 24x7 Postgres support!

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to