Fix get_name_for_var_field() to deal with RECORD Params.
authorTom Lane <[email protected]>
Wed, 7 Sep 2011 17:01:15 +0000 (13:01 -0400)
committerTom Lane <[email protected]>
Wed, 7 Sep 2011 17:02:06 +0000 (13:02 -0400)
commit90398132417232cb56dcda53a4cb66ed2d579681
treebe0f32ac05f6fdc30bff96610a6870012f565719
parentd5d94e16011a4fbb52de13a3d1ca326ad0c4ff36
Fix get_name_for_var_field() to deal with RECORD Params.

With 9.1's use of Params to pass down values from NestLoop join nodes
to their inner plans, it is possible for a Param to have type RECORD, in
which case the set of fields comprising the value isn't determinable by
inspection of the Param alone.  However, just as with a Var of type RECORD,
we can find out what we need to know if we can locate the expression that
the Param represents.  We already knew how to do this in get_parameter(),
but I'd overlooked the need to be able to cope in get_name_for_var_field(),
which led to EXPLAIN failing with "record type has not been registered".

To fix, refactor the search code in get_parameter() so it can be used by
both functions.

Per report from Marti Raudsepp.
src/backend/utils/adt/ruleutils.c