1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Revise implementation of SubLinks so that there is a consistent,

documented intepretation of the lefthand and oper fields.  Fix a number of
obscure problems while at it --- for example, the old code failed if the parser
decided to insert a type-coercion function just below the operator of a
SubLink.
CAUTION: this will break stored rules that contain subplans.  You may
need to initdb.
This commit is contained in:
Tom Lane
1999-08-25 23:21:43 +00:00
parent edda70c0de
commit 42af56e1ea
8 changed files with 326 additions and 322 deletions

View File

@ -94,8 +94,25 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext)
Const *con = lsecond(expr->args);
bool isnull;
/*
* The righthand side of the expression should be either a Const
* or a function call taking a Const as arg (the function would
* be a run-time type coercion inserted by the parser to get to
* the input type needed by the operator). Find the Const node
* and insert the actual righthand side value into it.
*/
if (! IsA(con, Const))
{
Assert(IsA(con, Expr));
con = lfirst(((Expr *) con)->args);
Assert(IsA(con, Const));
}
con->constvalue = heap_getattr(tup, i, tdesc, &(con->constisnull));
result = ExecEvalExpr((Node *) expr, econtext, &isnull, (bool *) NULL);
/*
* Now we can eval the expression.
*/
result = ExecEvalExpr((Node *) expr, econtext, &isnull,
(bool *) NULL);
if (isnull)
{
if (subLinkType == EXPR_SUBLINK)