Re: BUG #5240: Stable Functions that return a table type with a dropped column fail

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: dgardner(at)creatureshop(dot)com ("David Gardner"), pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5240: Stable Functions that return a table type with a dropped column fail
Date: 2009-12-12 01:33:25
Message-ID: 24858.1260581605@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> I don't think it's particularly closely related to #4907.

Yeah. I think the real problem is that set_subqueryscan_references
is overly optimistic about how much work it has to do:

* ... Notice we do
* not do set_upper_references() here, because a SubqueryScan will
* always have been created with correct references to its subplan's
* outputs to begin with.

The upper query will have Vars with attnos that correspond to the
function's output rowtype, ie, 1,2,3,5 in this example. However the
actual output of the lower query only has 4 columns. Kinda surprising
we never hit this before, really, although I guess there are not that
many cases where a subquery could have a named rowtype.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Nagy Daniel 2009-12-12 09:41:55 Re: BUG #5238: frequent signal 11 segfaults
Previous Message Andrew Gierth 2009-12-11 22:17:02 Re: BUG #5240: Stable Functions that return a table type with a dropped column fail