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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, Merlin Moncure <mmoncure(at)gmail(dot)com>
Subject: Re: pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)
Date: 2010-07-07 23:04:31
Message-ID: AANLkTin-GMmoEQY4aJpXNLmD6bnEGuopgzI_8xqd9gjH@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Jul 7, 2010 at 6:55 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-07-07 23:43:44 Re: pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)
Previous Message Tom Lane 2010-07-07 22:55:50 pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-07-07 23:09:43 Re: Reviewfest 2010-06 Plans and Call for Reviewers
Previous Message Tom Lane 2010-07-07 22:55:50 pg_dump and join aliases (was Re: [BUGS] ERROR: cannot handle unplanned sub-select)