Re: [HACKERS] pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)

2010-07-07 Thread Robert Haas
On Wed, Jul 7, 2010 at 7:43 PM, Tom Lane wrote: > Anyway, the way it works is that the parser generates "alias Vars" that > refer to the join RTE, mainly because this makes life simpler for > ruleutils.  But the planner prefers to work with the "real" underlying > columns whenever those are semant

Re: [HACKERS] pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)

2010-07-07 Thread Tom Lane
Robert Haas writes: > I'm lost. What's a join alias var? Suppose we have t1 with columns a,b,c and t2 with columns d,e,f, then consider select a from t1 join t2 on (whatever) select t1.a from t1 join t2 on (whatever) In the first case the parser generates a Var that references

Re: [HACKERS] pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)

2010-07-07 Thread Robert Haas
On Wed, Jul 7, 2010 at 6:55 PM, Tom Lane wrote: > After some investigation I was able to simplify it to the following > example using the regression database: > > select >  (select sq1) as qq1 > from >  (select exists(select 1 from int4_tbl where f1 = q2) as sq1, 42 as dummy >   from int8_tbl) sq0

[HACKERS] pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)

2010-07-07 Thread Tom Lane
Merlin sent me a test case off-list for the problem mentioned here: http://archives.postgresql.org/pgsql-bugs/2010-07/msg00025.php After some investigation I was able to simplify it to the following example using the regression database: select (select sq1) as qq1 from (select exists(select 1