Give a useful error message if a RangeVar is encountered in an expression.
Per example from Ian Barwick, 28-Oct-03.
This commit is contained in:
parent
abec4cbf1f
commit
a35deb5400
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.153 2003/08/17 23:43:26 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.154 2003/10/29 18:10:15 tgl Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -2412,6 +2412,16 @@ expression_tree_walker(Node *node,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case T_RangeVar:
|
||||||
|
/*
|
||||||
|
* Give a useful complaint if someone uses a bare relation name
|
||||||
|
* in an expression (see comments in transformColumnRef()).
|
||||||
|
*/
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
|
errmsg("relation reference \"%s\" cannot be used in an expression",
|
||||||
|
((RangeVar *) node)->relname)));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "unrecognized node type: %d",
|
elog(ERROR, "unrecognized node type: %d",
|
||||||
(int) nodeTag(node));
|
(int) nodeTag(node));
|
||||||
@ -2879,6 +2889,16 @@ expression_tree_mutator(Node *node,
|
|||||||
return (Node *) newnode;
|
return (Node *) newnode;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case T_RangeVar:
|
||||||
|
/*
|
||||||
|
* Give a useful complaint if someone uses a bare relation name
|
||||||
|
* in an expression (see comments in transformColumnRef()).
|
||||||
|
*/
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||||
|
errmsg("relation reference \"%s\" cannot be used in an expression",
|
||||||
|
((RangeVar *) node)->relname)));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "unrecognized node type: %d",
|
elog(ERROR, "unrecognized node type: %d",
|
||||||
(int) nodeTag(node));
|
(int) nodeTag(node));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user