Andrew Dunstan <andrew@dunslane.net> writes:
> On 02/13/2012 11:00 AM, Tom Lane wrote:
>> This is surely fixable by passing a bit more information down. If you
>> (Andrew) have something that covers everything but this issue, pass it
>> over and I'll take a whack at it.
> What I have fixes one of the three cases I have identified that appear
> to need fixing, the one that caused the json tests to crash with your
> original partial patch. See
> <https://bitbucket.org/adunstan/pgdevel/changesets/tip/rowexprs>. I
> won't have time to return to this for a few days. The two remaining
> cases should be fairly independent I think. If you don't get to this
> before then I'll look at the flatten_join_alias_vars_mutator case again
> and try to fix it based on the above, and then give you what I've got.
OK, I fixed this up and committed it. I made some cosmetic changes
(the most notable being that the definition of RowExpr is really
changing here, and so should its comment). The adjust_appendrel_attrs
situation was fixed by passing in the PlannerInfo, which is something
that probably should have been made available all along --- there are
very few nontrivial functions in the planner that don't need it.
I'm still a bit annoyed by the behavior I mentioned here,
http://archives.postgresql.org/pgsql-hackers/2011-11/msg01031.php
that we don't get "real" column names from an unflattened VALUES RTE.
Might be worth looking into that, but I don't have time for it.
regards, tom lane