|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.137 2002/12/12 20:35:13 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.138 2002/12/27 20:06:19 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -934,6 +934,7 @@ exprType(Node *expr)
|
934 | 934 | if (!qtree|| !IsA(qtree,Query))
|
935 | 935 | elog(ERROR,"exprType: Cannot get type for untransformed sublink");
|
936 | 936 | tent= (TargetEntry*)lfirst(qtree->targetList);
|
| 937 | +Assert(IsA(tent,TargetEntry)); |
937 | 938 | type=tent->resdom->restype;
|
938 | 939 | }
|
939 | 940 | else
|
@@ -967,6 +968,16 @@ exprType(Node *expr)
|
967 | 968 | caseT_ConstraintTestValue:
|
968 | 969 | type= ((ConstraintTestValue*)expr)->typeId;
|
969 | 970 | break;
|
| 971 | +caseT_RangeVar: |
| 972 | +/* |
| 973 | + * If someone uses a bare relation name in an expression, |
| 974 | + * we will likely first notice a problem here (see comments in |
| 975 | + * transformColumnRef()). Issue an appropriate error message. |
| 976 | + */ |
| 977 | +elog(ERROR,"Relation reference \"%s\" cannot be used in an expression", |
| 978 | + ((RangeVar*)expr)->relname); |
| 979 | +type=InvalidOid;/* keep compiler quiet */ |
| 980 | +break; |
970 | 981 | default:
|
971 | 982 | elog(ERROR,"exprType: Do not know how to get type for %d node",
|
972 | 983 | nodeTag(expr));
|
|