git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6c08905)
Deliver better error message when a relation name is used in an expression.
2002年12月27日 20:06:19 +0000 (20:06 +0000)
2002年12月27日 20:06:19 +0000 (20:06 +0000)
Per report from Ian Barwick.


diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index db0667ef16ec6c6370720158e216ad11035ffcf0..9705ca5d7de558a26c183987e6e68253df8694e6 100644 (file)
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.137 2002年12月12日 20:35:13 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.138 2002年12月27日 20:06:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -934,6 +934,7 @@ exprType(Node *expr)
if (!qtree || !IsA(qtree, Query))
elog(ERROR, "exprType: Cannot get type for untransformed sublink");
tent = (TargetEntry *) lfirst(qtree->targetList);
+ Assert(IsA(tent, TargetEntry));
type = tent->resdom->restype;
}
else
@@ -967,6 +968,16 @@ exprType(Node *expr)
case T_ConstraintTestValue:
type = ((ConstraintTestValue *) expr)->typeId;
break;
+ case T_RangeVar:
+ /*
+ * If someone uses a bare relation name in an expression,
+ * we will likely first notice a problem here (see comments in
+ * transformColumnRef()). Issue an appropriate error message.
+ */
+ elog(ERROR, "Relation reference \"%s\" cannot be used in an expression",
+ ((RangeVar *) expr)->relname);
+ type = InvalidOid; /* keep compiler quiet */
+ break;
default:
elog(ERROR, "exprType: Do not know how to get type for %d node",
nodeTag(expr));
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /