aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execExpr.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2017-08-20 11:19:07 -0700
committerAndres Freund <andres@anarazel.de>2017-08-20 11:19:07 -0700
commit2cd70845240087da205695baedab6412342d1dbe (patch)
tree20a3b6a2231dae248218ac54983c7a854328265f /src/backend/executor/execExpr.c
parentb1c2d76a2fcef812af0be3343082414d401909c8 (diff)
downloadpostgresql-2cd70845240087da205695baedab6412342d1dbe.tar.gz
postgresql-2cd70845240087da205695baedab6412342d1dbe.zip
Change tupledesc->attrs[n] to TupleDescAttr(tupledesc, n).
This is a mechanical change in preparation for a later commit that will change the layout of TupleDesc. Introducing a macro to abstract the details of where attributes are stored will allow us to change that in separate step and revise it in future. Author: Thomas Munro, editorialized by Andres Freund Reviewed-By: Andres Freund Discussion: https://postgr.es/m/CAEepm=0ZtQ-SpsgCyzzYpsXS6e=kZWqk3g5Ygn3MDV7A8dabUA@mail.gmail.com
Diffstat (limited to 'src/backend/executor/execExpr.c')
-rw-r--r--src/backend/executor/execExpr.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index 7496189fabf..be9d23bc323 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -347,7 +347,7 @@ ExecBuildProjectionInfo(List *targetList,
isSafeVar = true; /* can't check, just assume OK */
else if (attnum <= inputDesc->natts)
{
- Form_pg_attribute attr = inputDesc->attrs[attnum - 1];
+ Form_pg_attribute attr = TupleDescAttr(inputDesc, attnum - 1);
/*
* If user attribute is dropped or has a type mismatch, don't
@@ -1492,7 +1492,6 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state,
RowExpr *rowexpr = (RowExpr *) node;
int nelems = list_length(rowexpr->args);
TupleDesc tupdesc;
- Form_pg_attribute *attrs;
int i;
ListCell *l;
@@ -1539,13 +1538,13 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state,
memset(scratch.d.row.elemnulls, true, sizeof(bool) * nelems);
/* Set up evaluation, skipping any deleted columns */
- attrs = tupdesc->attrs;
i = 0;
foreach(l, rowexpr->args)
{
+ Form_pg_attribute att = TupleDescAttr(tupdesc, i);
Expr *e = (Expr *) lfirst(l);
- if (!attrs[i]->attisdropped)
+ if (!att->attisdropped)
{
/*
* Guard against ALTER COLUMN TYPE on rowtype since
@@ -1553,12 +1552,12 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state,
* typmod too? Not sure we can be sure it'll be the
* same.
*/
- if (exprType((Node *) e) != attrs[i]->atttypid)
+ if (exprType((Node *) e) != att->atttypid)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("ROW() column has type %s instead of type %s",
format_type_be(exprType((Node *) e)),
- format_type_be(attrs[i]->atttypid))));
+ format_type_be(att->atttypid))));
}
else
{