Re: ERROR: replace_vars_with_subplan_refs (!?)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ldm(at)apartia(dot)ch
Cc: PGSQL-SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: ERROR: replace_vars_with_subplan_refs (!?)
Date: 2000-09-20 16:13:12
Message-ID: 23699.969466392@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Louis-David Mitterrand <ldm(at)apartia(dot)ch> writes:
> On Wed, Sep 20, 2000 at 10:43:59AM -0400, Tom Lane wrote:
>> Louis-David Mitterrand <cunctator(at)apartia(dot)ch> writes:
>>>> How should I interpret that error?
>>>> ERROR: replace_vars_with_subplan_refs: variable not in subplan target list
>>
>> Looks like a bug to me. I think this may already be fixed in current
>> sources, but not sure. Could I trouble you for the relevant table
>> declarations, so I can try the example without a lot of guessing?

> Please find attached the full dump.

OK, this is indeed fixed in current sources. I think you are running
into the same problem you reported in June, namely that subselects
appearing in the targetlist of an Append plan are misprocessed in 7.0.*.
Append is mainly used for handling inherited queries, so it's the
combination of inheritance and subselect in targetlist that's needed
to trigger the bug.

This probably also explains the other report you filed this morning;
once the subselect is messed up, all sorts of things start to go wrong
:-(

I think you could back-patch the fix into 7.0.* just by dropping rev
1.64 of setrefs.c into the 7.0 source tree --- see
http://www.postgresql.org/cgi/cvswebtest.cgi/pgsql/src/backend/optimizer/plan/setrefs.c
for that version.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2000-09-20 16:20:25 [Fwd: Re: no ORDER BY in subselects?]
Previous Message Josh Berkus 2000-09-20 15:38:15 Re: [GENERAL] Foreign Keys Help Delete!