mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Extend the parser location infrastructure to include a location field in
most node types used in expression trees (both before and after parse analysis). This allows us to place an error cursor in many situations where we formerly could not, because the information wasn't available beyond the very first level of parse analysis. There's a fair amount of work still to be done to persuade individual ereport() calls to actually include an error location, but this gets the initdb-forcing part of the work out of the way; and the situation is already markedly better than before for complaints about unimplementable implicit casts, such as CASE and UNION constructs with incompatible alternative data types. Per my proposal of a few days ago.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.161 2008/08/25 22:42:33 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.162 2008/08/28 23:09:48 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -318,7 +318,7 @@ markTargetListOrigin(ParseState *pstate, TargetEntry *tle,
|
||||
* colname target column name (ie, name of attribute to be assigned to)
|
||||
* attrno target attribute number
|
||||
* indirection subscripts/field names for target column, if any
|
||||
* location error cursor position, or -1
|
||||
* location error cursor position for the target column, or -1
|
||||
*
|
||||
* Returns the modified expression.
|
||||
*/
|
||||
@ -403,7 +403,8 @@ transformAssignedExpr(ParseState *pstate,
|
||||
*/
|
||||
colVar = (Node *) make_var(pstate,
|
||||
pstate->p_target_rangetblentry,
|
||||
attrno);
|
||||
attrno,
|
||||
location);
|
||||
}
|
||||
|
||||
expr = (Expr *)
|
||||
@ -428,7 +429,8 @@ transformAssignedExpr(ParseState *pstate,
|
||||
(Node *) expr, type_id,
|
||||
attrtype, attrtypmod,
|
||||
COERCION_ASSIGNMENT,
|
||||
COERCE_IMPLICIT_CAST);
|
||||
COERCE_IMPLICIT_CAST,
|
||||
-1);
|
||||
if (expr == NULL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||
@ -677,7 +679,8 @@ transformAssignmentIndirection(ParseState *pstate,
|
||||
rhs, exprType(rhs),
|
||||
targetTypeId, targetTypMod,
|
||||
COERCION_ASSIGNMENT,
|
||||
COERCE_IMPLICIT_CAST);
|
||||
COERCE_IMPLICIT_CAST,
|
||||
-1);
|
||||
if (result == NULL)
|
||||
{
|
||||
if (targetIsArray)
|
||||
|
Reference in New Issue
Block a user