Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit76d09f4

Browse files
committed
Fix case where a function in FROM returns a scalar type, but is
referred to with whole-tuple syntax.
1 parent0d93e38 commit76d09f4

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

‎src/backend/parser/parse_func.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.137 2002/09/18 21:35:22 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.138 2002/10/19 21:23:20 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -191,9 +191,33 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
191191
if (!OidIsValid(toid))
192192
elog(ERROR,"Cannot find type OID for relation %u",
193193
rte->relid);
194+
/* replace RangeVar in the arg list */
195+
lfirst(i)=makeVar(vnum,
196+
InvalidAttrNumber,
197+
toid,
198+
sizeof(Pointer),
199+
sublevels_up);
194200
break;
195201
caseRTE_FUNCTION:
196202
toid=exprType(rte->funcexpr);
203+
if (get_typtype(toid)=='c')
204+
{
205+
/* func returns composite; same as relation case */
206+
lfirst(i)=makeVar(vnum,
207+
InvalidAttrNumber,
208+
toid,
209+
sizeof(Pointer),
210+
sublevels_up);
211+
}
212+
else
213+
{
214+
/* func returns scalar; use attno 1 instead */
215+
lfirst(i)=makeVar(vnum,
216+
1,
217+
toid,
218+
-1,
219+
sublevels_up);
220+
}
197221
break;
198222
default:
199223

@@ -210,13 +234,6 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
210234
toid=InvalidOid;/* keep compiler quiet */
211235
break;
212236
}
213-
214-
/* replace RangeVar in the arg list */
215-
lfirst(i)=makeVar(vnum,
216-
InvalidAttrNumber,
217-
toid,
218-
sizeof(Pointer),
219-
sublevels_up);
220237
}
221238
else
222239
toid=exprType(arg);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp