mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Fix *-qualification of named parameters in SQL-language functions.
Given a composite-type parameter named x, "$1.*" worked fine, but "x.*"
not so much. This has been broken since named parameter references were
added in commit 9bff0780cf
, so patch back
to 9.2. Per bug #9085 from Hardy Falk.
This commit is contained in:
@ -309,6 +309,11 @@ sql_fn_post_column_ref(ParseState *pstate, ColumnRef *cref, Node *var)
|
||||
* (the first possibility takes precedence)
|
||||
* A.B.C A = function name, B = record-typed parameter name,
|
||||
* C = field name
|
||||
* A.* Whole-row reference to composite parameter A.
|
||||
* A.B.* Same, with A = function name, B = parameter name
|
||||
*
|
||||
* Here, it's sufficient to ignore the "*" in the last two cases --- the
|
||||
* main parser will take care of expanding the whole-row reference.
|
||||
*----------
|
||||
*/
|
||||
nnames = list_length(cref->fields);
|
||||
@ -316,6 +321,9 @@ sql_fn_post_column_ref(ParseState *pstate, ColumnRef *cref, Node *var)
|
||||
if (nnames > 3)
|
||||
return NULL;
|
||||
|
||||
if (IsA(llast(cref->fields), A_Star))
|
||||
nnames--;
|
||||
|
||||
field1 = (Node *) linitial(cref->fields);
|
||||
Assert(IsA(field1, String));
|
||||
name1 = strVal(field1);
|
||||
|
Reference in New Issue
Block a user