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/include | |
| parent | c015ccb306ec81bca3023818c9cf0113cae25be1 (diff) | |
| download | postgresql-02a30a09f9e57a29f7bda82f5f4bfc214eed3980.tar.gz | |
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/include')
| -rw-r--r-- | src/include/catalog/heap.h | 4 | ||||
| -rw-r--r-- | src/include/parser/parse_relation.h | 2 | ||||
| -rw-r--r-- | src/include/utils/builtins.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index b3e8fdd9c6..39f04b06ee 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -127,10 +127,10 @@ extern void RemoveAttrDefault(Oid relid, AttrNumber attnum, extern void RemoveAttrDefaultById(Oid attrdefId); extern void RemoveStatistics(Oid relid, AttrNumber attnum); -extern Form_pg_attribute SystemAttributeDefinition(AttrNumber attno, +extern const FormData_pg_attribute *SystemAttributeDefinition(AttrNumber attno, bool relhasoids); -extern Form_pg_attribute SystemAttributeByName(const char *attname, +extern const FormData_pg_attribute *SystemAttributeByName(const char *attname, bool relhasoids); extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind, diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h index 687a7d7b1b..bf0c3b057b 100644 --- a/src/include/parser/parse_relation.h +++ b/src/include/parser/parse_relation.h @@ -125,7 +125,7 @@ extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, extern List *expandRelAttrs(ParseState *pstate, RangeTblEntry *rte, int rtindex, int sublevels_up, int location); extern int attnameAttNum(Relation rd, const char *attname, bool sysColOK); -extern Name attnumAttName(Relation rd, int attid); +extern const NameData *attnumAttName(Relation rd, int attid); extern Oid attnumTypeId(Relation rd, int attid); extern Oid attnumCollationId(Relation rd, int attid); extern bool isQueryUsingTempRelation(Query *query); diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 6f55699912..61785a2433 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -37,7 +37,7 @@ extern unsigned hex_decode(const char *src, unsigned len, char *dst); extern int2vector *buildint2vector(const int16 *int2s, int n); /* name.c */ -extern int namecpy(Name n1, Name n2); +extern int namecpy(Name n1, const NameData *n2); extern int namestrcpy(Name name, const char *str); extern int namestrcmp(Name name, const char *str); |
