diff options
author | Andres Freund | 2017-08-20 18:19:07 +0000 |
---|---|---|
committer | Andres Freund | 2017-08-20 18:19:07 +0000 |
commit | 2cd70845240087da205695baedab6412342d1dbe (patch) | |
tree | 20a3b6a2231dae248218ac54983c7a854328265f /src/pl/plpython/plpy_resultobject.c | |
parent | b1c2d76a2fcef812af0be3343082414d401909c8 (diff) |
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/pl/plpython/plpy_resultobject.c')
-rw-r--r-- | src/pl/plpython/plpy_resultobject.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/pl/plpython/plpy_resultobject.c b/src/pl/plpython/plpy_resultobject.c index 077bde6dc35..098a366f6fa 100644 --- a/src/pl/plpython/plpy_resultobject.c +++ b/src/pl/plpython/plpy_resultobject.c @@ -148,7 +148,11 @@ PLy_result_colnames(PyObject *self, PyObject *unused) list = PyList_New(ob->tupdesc->natts); for (i = 0; i < ob->tupdesc->natts; i++) - PyList_SET_ITEM(list, i, PyString_FromString(NameStr(ob->tupdesc->attrs[i]->attname))); + { + Form_pg_attribute attr = TupleDescAttr(ob->tupdesc, i); + + PyList_SET_ITEM(list, i, PyString_FromString(NameStr(attr->attname))); + } return list; } @@ -168,7 +172,11 @@ PLy_result_coltypes(PyObject *self, PyObject *unused) list = PyList_New(ob->tupdesc->natts); for (i = 0; i < ob->tupdesc->natts; i++) - PyList_SET_ITEM(list, i, PyInt_FromLong(ob->tupdesc->attrs[i]->atttypid)); + { + Form_pg_attribute attr = TupleDescAttr(ob->tupdesc, i); + + PyList_SET_ITEM(list, i, PyInt_FromLong(attr->atttypid)); + } return list; } @@ -188,7 +196,11 @@ PLy_result_coltypmods(PyObject *self, PyObject *unused) list = PyList_New(ob->tupdesc->natts); for (i = 0; i < ob->tupdesc->natts; i++) - PyList_SET_ITEM(list, i, PyInt_FromLong(ob->tupdesc->attrs[i]->atttypmod)); + { + Form_pg_attribute attr = TupleDescAttr(ob->tupdesc, i); + + PyList_SET_ITEM(list, i, PyInt_FromLong(attr->atttypmod)); + } return list; } |