From: Andres Freund Date: Fri, 16 Aug 2019 17:33:30 +0000 (-0700) Subject: Don't include utils/array.h from acl.h. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a04d345fd8094058f08344af93022566222733a;p=postgresql Don't include utils/array.h from acl.h. For most uses of acl.h the details of how "Acl" internally looks like are irrelevant. It might make sense to move a lot of the implementation details into a separate header at a later point. The main motivation of this change is to avoid including fmgr.h (via array.h, which needs it for exposed structs) in a lot of files that otherwise don't need it. A subsequent commit will remove the fmgr.h include from a lot of files. Directly include utils/array.h and utils/expandeddatum.h from the files that need them, but previously included them indirectly, via acl.h. Author: Andres Freund Discussion: https://postgr.es/m/20190803193733.g3l3x3o42uv4qj7l@alap3.anarazel.de --- diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c index e69913302a..9374c4aabc 100644 --- a/contrib/pageinspect/hashfuncs.c +++ b/contrib/pageinspect/hashfuncs.c @@ -18,6 +18,7 @@ #include "catalog/pg_am.h" #include "funcapi.h" #include "miscadmin.h" +#include "utils/array.h" #include "utils/builtins.h" #include "utils/rel.h" diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c index 6d09f2a218..58e2432aac 100644 --- a/src/backend/executor/execExpr.c +++ b/src/backend/executor/execExpr.c @@ -42,6 +42,7 @@ #include "nodes/nodeFuncs.h" #include "optimizer/optimizer.h" #include "pgstat.h" +#include "utils/array.h" #include "utils/builtins.h" #include "utils/datum.h" #include "utils/lsyscache.h" diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index 66a67c72b2..d61f75bc3b 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -62,6 +62,7 @@ #include "executor/execExpr.h" #include "executor/nodeSubplan.h" #include "funcapi.h" +#include "utils/array.h" #include "utils/memutils.h" #include "miscadmin.h" #include "nodes/nodeFuncs.h" diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c index 5ee2a464bb..697f1fed71 100644 --- a/src/backend/executor/execTuples.c +++ b/src/backend/executor/execTuples.c @@ -65,6 +65,7 @@ #include "nodes/nodeFuncs.h" #include "storage/bufmgr.h" #include "utils/builtins.h" +#include "utils/expandeddatum.h" #include "utils/lsyscache.h" #include "utils/typcache.h" diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index a9a1fd022a..58c376aeb7 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -231,6 +231,7 @@ #include "parser/parse_coerce.h" #include "utils/acl.h" #include "utils/builtins.h" +#include "utils/expandeddatum.h" #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/syscache.h" diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c index cb81357304..b5d3f3c421 100644 --- a/src/backend/executor/nodeWindowAgg.c +++ b/src/backend/executor/nodeWindowAgg.c @@ -46,6 +46,7 @@ #include "parser/parse_coerce.h" #include "utils/acl.h" #include "utils/builtins.h" +#include "utils/expandeddatum.h" #include "utils/datum.h" #include "utils/lsyscache.h" #include "utils/memutils.h" diff --git a/src/backend/partitioning/partprune.c b/src/backend/partitioning/partprune.c index 44bcff2d08..29f1c11b24 100644 --- a/src/backend/partitioning/partprune.c +++ b/src/backend/partitioning/partprune.c @@ -53,6 +53,7 @@ #include "partitioning/partbounds.h" #include "partitioning/partprune.h" #include "rewrite/rewriteManip.h" +#include "utils/array.h" #include "utils/lsyscache.h" diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c index 23c74f7d90..48f17ba8d5 100644 --- a/src/backend/statistics/extended_stats.c +++ b/src/backend/statistics/extended_stats.c @@ -31,6 +31,7 @@ #include "postmaster/autovacuum.h" #include "statistics/extended_stats_internal.h" #include "statistics/statistics.h" +#include "utils/array.h" #include "utils/builtins.h" #include "utils/fmgroids.h" #include "utils/lsyscache.h" diff --git a/src/backend/statistics/mcv.c b/src/backend/statistics/mcv.c index cec06f8c44..bae6f21968 100644 --- a/src/backend/statistics/mcv.c +++ b/src/backend/statistics/mcv.c @@ -26,6 +26,7 @@ #include "optimizer/clauses.h" #include "statistics/extended_stats_internal.h" #include "statistics/statistics.h" +#include "utils/array.h" #include "utils/builtins.h" #include "utils/bytea.h" #include "utils/fmgroids.h" diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index cfd139e6e9..d7e6100ccb 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -30,6 +30,7 @@ #include "funcapi.h" #include "miscadmin.h" #include "utils/acl.h" +#include "utils/array.h" #include "utils/builtins.h" #include "utils/catcache.h" #include "utils/hashutils.h" diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index 696a7fdf91..28d042273e 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -25,6 +25,7 @@ #include "miscadmin.h" #include "parser/parse_coerce.h" #include "tsearch/ts_utils.h" +#include "utils/array.h" #include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/regproc.h" diff --git a/src/include/catalog/objectaddress.h b/src/include/catalog/objectaddress.h index 95cc315868..7e61569f9f 100644 --- a/src/include/catalog/objectaddress.h +++ b/src/include/catalog/objectaddress.h @@ -77,7 +77,7 @@ extern char *getObjectTypeDescription(const ObjectAddress *object); extern char *getObjectIdentity(const ObjectAddress *address); extern char *getObjectIdentityParts(const ObjectAddress *address, List **objname, List **objargs); -extern ArrayType *strlist_to_textarray(List *list); +extern struct ArrayType *strlist_to_textarray(List *list); extern ObjectType get_relkind_objtype(char relkind); diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index f4c160ee72..b99da73728 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -35,7 +35,6 @@ #include "access/htup.h" #include "nodes/parsenodes.h" #include "parser/parse_node.h" -#include "utils/array.h" #include "utils/snapshot.h" @@ -104,7 +103,7 @@ typedef struct AclItem /* * Acl a one-dimensional array of AclItem */ -typedef ArrayType Acl; +typedef struct ArrayType Acl; #define ACL_NUM(ACL) (ARR_DIMS(ACL)[0]) #define ACL_DAT(ACL) ((AclItem *) ARR_DATA_PTR(ACL)) diff --git a/src/include/utils/array.h b/src/include/utils/array.h index b441eb452b..5cfafe0045 100644 --- a/src/include/utils/array.h +++ b/src/include/utils/array.h @@ -77,7 +77,7 @@ struct ExprContext; * CAUTION: if you change the header for ordinary arrays you will also * need to change the headers for oidvector and int2vector! */ -typedef struct +typedef struct ArrayType { int32 vl_len_; /* varlena header (do not touch directly!) */ int ndim; /* # of dimensions */