diff options
author | Andres Freund <andres@anarazel.de> | 2018-10-16 09:44:43 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2018-10-16 09:44:43 -0700 |
commit | 02a30a09f9e57a29f7bda82f5f4bfc214eed3980 (patch) | |
tree | 7e47acc68b2ddfcc4d45dbd723f5ea9b31c3e0d5 /src/backend/utils/adt/expandedrecord.c | |
parent | c015ccb306ec81bca3023818c9cf0113cae25be1 (diff) | |
download | postgresql-02a30a09f9e57a29f7bda82f5f4bfc214eed3980.tar.gz postgresql-02a30a09f9e57a29f7bda82f5f4bfc214eed3980.zip |
Correct constness of system attributes in heap.c & prerequisites.
This allows the compiler / linker to mark affected pages as read-only.
There's a fair number of pre-requisite changes, to allow the const
properly be propagated. Most of consts were already required for
correctness anyway, just not represented on the type-level. Arguably
we could be more aggressive in using consts in related code, but..
This requires using a few of the types underlying typedefs that
removes pointers (e.g. const NameData *) as declaring the typedefed
type constant doesn't have the same meaning (it makes the variable
const, not what it points to).
Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de
Diffstat (limited to 'src/backend/utils/adt/expandedrecord.c')
-rw-r--r-- | src/backend/utils/adt/expandedrecord.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backend/utils/adt/expandedrecord.c b/src/backend/utils/adt/expandedrecord.c index b1b6883c19f..9aa6f3aac51 100644 --- a/src/backend/utils/adt/expandedrecord.c +++ b/src/backend/utils/adt/expandedrecord.c @@ -1025,6 +1025,7 @@ expanded_record_lookup_field(ExpandedRecordHeader *erh, const char *fieldname, TupleDesc tupdesc; int fno; Form_pg_attribute attr; + const FormData_pg_attribute *sysattr; tupdesc = expanded_record_get_tupdesc(erh); @@ -1044,13 +1045,13 @@ expanded_record_lookup_field(ExpandedRecordHeader *erh, const char *fieldname, } /* How about system attributes? */ - attr = SystemAttributeByName(fieldname, tupdesc->tdhasoid); - if (attr != NULL) + sysattr = SystemAttributeByName(fieldname, tupdesc->tdhasoid); + if (sysattr != NULL) { - finfo->fnumber = attr->attnum; - finfo->ftypeid = attr->atttypid; - finfo->ftypmod = attr->atttypmod; - finfo->fcollation = attr->attcollation; + finfo->fnumber = sysattr->attnum; + finfo->ftypeid = sysattr->atttypid; + finfo->ftypmod = sysattr->atttypmod; + finfo->fcollation = sysattr->attcollation; return true; } |