Re: pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select) - Mailing list pgsql-hackers

From Robert Haas
Subject Re: pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)
Date
Msg-id AANLkTin-GMmoEQY4aJpXNLmD6bnEGuopgzI_8xqd9gjH@mail.gmail.com
Whole thread Raw
In response to pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)
List pgsql-hackers
On Wed, Jul 7, 2010 at 6:55 PM, Tom Lane <tgl@sss.pgh.pa.us> 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
>  join
>  int4_tbl i4 on dummy = i4.f1;
>
> [discussion of bug]
>
> What seems more interesting is that I initially had a hard time
> reproducing the bug under different conditions, and didn't figure out
> what was going on until I realized that I had used pg_dump to
> consolidate the multiple files Merlin sent ... and *reloading pg_dump's
> version of the views didn't exhibit the bug*.  This is because pg_dump,
> or more accurately ruleutils.c, has a habit of qualifying variable
> references whether or not they were qualified in the original query.
> If you turn the above example into a view and then dump it, you'll get
>
>        ... (select sq0.sq1) as qq1 ...
>
> and that doesn't tickle this bug.  (That's because "sq0.sq1" isn't a
> join alias Var, whereas unqualified "sq1" is.)

I'm lost.  What's a join alias var?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)
Next
From: Robert Haas
Date:
Subject: Re: [RRR] Reviewfest 2010-06 Plans and Call for Reviewers