mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +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:
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.58 2008/01/01 19:45:50 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.59 2008/08/28 23:09:46 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -84,6 +84,9 @@ makeVar(Index varno,
|
||||
var->varnoold = varno;
|
||||
var->varoattno = varattno;
|
||||
|
||||
/* Likewise, we just set location to "unknown" here */
|
||||
var->location = -1;
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
@ -168,6 +171,7 @@ makeConst(Oid consttype,
|
||||
cnst->constvalue = constvalue;
|
||||
cnst->constisnull = constisnull;
|
||||
cnst->constbyval = constbyval;
|
||||
cnst->location = -1; /* "unknown" */
|
||||
|
||||
return cnst;
|
||||
}
|
||||
@ -211,12 +215,13 @@ makeBoolConst(bool value, bool isnull)
|
||||
* creates a BoolExpr node
|
||||
*/
|
||||
Expr *
|
||||
makeBoolExpr(BoolExprType boolop, List *args)
|
||||
makeBoolExpr(BoolExprType boolop, List *args, int location)
|
||||
{
|
||||
BoolExpr *b = makeNode(BoolExpr);
|
||||
|
||||
b->boolop = boolop;
|
||||
b->args = args;
|
||||
b->location = location;
|
||||
|
||||
return (Expr *) b;
|
||||
}
|
||||
@ -251,6 +256,7 @@ makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, CoercionForm rformat)
|
||||
r->resulttype = rtype;
|
||||
r->resulttypmod = rtypmod;
|
||||
r->relabelformat = rformat;
|
||||
r->location = -1;
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -336,6 +342,7 @@ makeFuncExpr(Oid funcid, Oid rettype, List *args, CoercionForm fformat)
|
||||
funcexpr->funcretset = false; /* only allowed case here */
|
||||
funcexpr->funcformat = fformat;
|
||||
funcexpr->args = args;
|
||||
funcexpr->location = -1;
|
||||
|
||||
return funcexpr;
|
||||
}
|
||||
|
Reference in New Issue
Block a user