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

Commitf0cc132

Browse files
committed
Fix oversight in recent rowtype-handling improvements: transformTargetList
should recognize 'foo.*' when the star appears in A_Indirection, not onlyin ColumnRef. This allows 'SELECT something.*' to do what the userexpects when the something is an expression yielding a row.
1 parent57d2665 commitf0cc132

File tree

3 files changed

+211
-124
lines changed

3 files changed

+211
-124
lines changed

‎src/backend/parser/parse_func.c

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.171 2004/06/16 01:26:45 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.172 2004/06/19 18:19:55 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -38,7 +38,6 @@ static Oid **argtype_inherit(int nargs, Oid *argtypes);
3838

3939
staticintfind_inheritors(Oidrelid,Oid**supervec);
4040
staticOid**gen_cross_product(InhPaths*arginh,intnargs);
41-
staticFieldSelect*setup_field_select(Node*input,char*attname,Oidrelid);
4241
staticvoidunknown_attribute(ParseState*pstate,Node*relref,char*attname);
4342

4443

@@ -1131,33 +1130,6 @@ make_fn_arguments(ParseState *pstate,
11311130
}
11321131
}
11331132

1134-
/*
1135-
* setup_field_select
1136-
*Build a FieldSelect node that says which attribute to project to.
1137-
*This routine is called by ParseFuncOrColumn() when we have found
1138-
*a projection on a function result or parameter.
1139-
*/
1140-
staticFieldSelect*
1141-
setup_field_select(Node*input,char*attname,Oidrelid)
1142-
{
1143-
FieldSelect*fselect=makeNode(FieldSelect);
1144-
AttrNumberattno;
1145-
1146-
attno=get_attnum(relid,attname);
1147-
if (attno==InvalidAttrNumber)
1148-
ereport(ERROR,
1149-
(errcode(ERRCODE_UNDEFINED_COLUMN),
1150-
errmsg("column \"%s\" of relation \"%s\" does not exist",
1151-
attname,get_rel_name(relid))));
1152-
1153-
fselect->arg= (Expr*)input;
1154-
fselect->fieldnum=attno;
1155-
fselect->resulttype=get_atttype(relid,attno);
1156-
fselect->resulttypmod=get_atttypmod(relid,attno);
1157-
1158-
returnfselect;
1159-
}
1160-
11611133
/*
11621134
* ParseComplexProjection -
11631135
* handles function calls with a single argument that is of complex type.
@@ -1170,6 +1142,7 @@ ParseComplexProjection(ParseState *pstate, char *funcname, Node *first_arg)
11701142
Oidargtype;
11711143
Oidargrelid;
11721144
AttrNumberattnum;
1145+
FieldSelect*fselect;
11731146

11741147
/*
11751148
* Special case for whole-row Vars so that we can resolve (foo.*).bar
@@ -1205,7 +1178,14 @@ ParseComplexProjection(ParseState *pstate, char *funcname, Node *first_arg)
12051178
returnNULL;/* funcname does not match any column */
12061179

12071180
/* Success, so generate a FieldSelect expression */
1208-
return (Node*)setup_field_select(first_arg,funcname,argrelid);
1181+
fselect=makeNode(FieldSelect);
1182+
fselect->arg= (Expr*)first_arg;
1183+
fselect->fieldnum=attnum;
1184+
get_atttypetypmod(argrelid,attnum,
1185+
&fselect->resulttype,
1186+
&fselect->resulttypmod);
1187+
1188+
return (Node*)fselect;
12091189
}
12101190

12111191
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp