From 9c0a0de4c91b2dc911220d769cf2c5f754cfcb90 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 8 Apr 2018 13:59:52 -0400 Subject: [PATCH] Switch client-side code to include catalog/pg_foo_d.h not pg_foo.h. Everything of use to frontend code should now appear in the _d.h files, and making this change frees us from needing to worry about whether the catalog header files proper are frontend-safe. Remove src/interfaces/ecpg/ecpglib/pg_type.h entirely, as the previous commit reduced it to a confusingly-named wrapper around pg_type_d.h. In passing, make test_rls_hooks.c follow project convention of including our own files with #include "" not <>. Discussion: https://postgr.es/m/23690.1523031777@sss.pgh.pa.us --- contrib/oid2name/oid2name.c | 2 +- contrib/vacuumlo/vacuumlo.c | 2 +- src/bin/initdb/initdb.c | 5 ++--- src/bin/pg_dump/common.c | 2 +- src/bin/pg_dump/pg_dump.c | 22 +++++++++---------- src/bin/pg_dump/pg_dump_sort.c | 2 +- src/bin/pg_rewind/filemap.c | 2 +- src/bin/pg_rewind/libpq_fetch.c | 2 +- src/bin/pg_upgrade/check.c | 2 +- src/bin/pg_upgrade/function.c | 2 +- src/bin/pg_upgrade/info.c | 2 +- src/bin/pg_upgrade/pg_upgrade.c | 2 +- src/bin/pg_upgrade/relfilenode.c | 2 +- src/bin/pg_upgrade/version.c | 2 +- src/bin/psql/command.c | 2 +- src/bin/psql/describe.c | 6 ++--- src/bin/psql/tab-complete.c | 2 +- src/bin/scripts/vacuumdb.c | 2 +- src/common/relpath.c | 2 +- src/fe_utils/print.c | 2 +- src/interfaces/ecpg/ecpglib/descriptor.c | 3 ++- src/interfaces/ecpg/ecpglib/execute.c | 2 +- src/interfaces/ecpg/ecpglib/pg_type.h | 18 --------------- src/interfaces/ecpg/ecpglib/sqlda.c | 3 ++- src/interfaces/ecpg/ecpglib/typename.c | 3 ++- .../modules/test_rls_hooks/test_rls_hooks.c | 20 ++++++++--------- src/tools/findoidjoins/findoidjoins.c | 2 +- 27 files changed, 51 insertions(+), 67 deletions(-) delete mode 100644 src/interfaces/ecpg/ecpglib/pg_type.h diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c index 769e527384..63e360c4c5 100644 --- a/contrib/oid2name/oid2name.c +++ b/contrib/oid2name/oid2name.c @@ -9,7 +9,7 @@ */ #include "postgres_fe.h" -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "fe_utils/connect.h" #include "libpq-fe.h" diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c index ab6b17c7f6..7eb474ca3e 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -21,7 +21,7 @@ #include #endif -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "fe_utils/connect.h" #include "libpq-fe.h" diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index ec1f0c4bff..e9f22c764e 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -61,9 +61,8 @@ #include "access/xlog_internal.h" #include "catalog/catalog.h" -#include "catalog/pg_authid.h" -#include "catalog/pg_class.h" -#include "catalog/pg_collation.h" +#include "catalog/pg_authid_d.h" +#include "catalog/pg_collation_d.h" #include "common/file_perm.h" #include "common/file_utils.h" #include "common/restricted_token.h" diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 0a758f14bf..e7db78b0ff 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -21,7 +21,7 @@ #include -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "fe_utils/string_utils.h" diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index d4c1b3261e..93c869fd68 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -42,17 +42,17 @@ #include "access/attnum.h" #include "access/sysattr.h" #include "access/transam.h" -#include "catalog/pg_aggregate.h" -#include "catalog/pg_am.h" -#include "catalog/pg_attribute.h" -#include "catalog/pg_cast.h" -#include "catalog/pg_class.h" -#include "catalog/pg_default_acl.h" -#include "catalog/pg_largeobject.h" -#include "catalog/pg_largeobject_metadata.h" -#include "catalog/pg_proc.h" -#include "catalog/pg_trigger.h" -#include "catalog/pg_type.h" +#include "catalog/pg_aggregate_d.h" +#include "catalog/pg_am_d.h" +#include "catalog/pg_attribute_d.h" +#include "catalog/pg_cast_d.h" +#include "catalog/pg_class_d.h" +#include "catalog/pg_default_acl_d.h" +#include "catalog/pg_largeobject_d.h" +#include "catalog/pg_largeobject_metadata_d.h" +#include "catalog/pg_proc_d.h" +#include "catalog/pg_trigger_d.h" +#include "catalog/pg_type_d.h" #include "libpq/libpq-fs.h" #include "dumputils.h" diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c index 5ce3c5d485..d2b0949d6b 100644 --- a/src/bin/pg_dump/pg_dump_sort.c +++ b/src/bin/pg_dump/pg_dump_sort.c @@ -19,7 +19,7 @@ #include "pg_backup_utils.h" #include "pg_dump.h" -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" /* translator: this is a module name */ static const char *modulename = gettext_noop("sorter"); diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c index 876a62ad58..c3fc519895 100644 --- a/src/bin/pg_rewind/filemap.c +++ b/src/bin/pg_rewind/filemap.c @@ -20,7 +20,7 @@ #include "common/string.h" #include "catalog/catalog.h" -#include "catalog/pg_tablespace.h" +#include "catalog/pg_tablespace_d.h" #include "storage/fd.h" filemap_t *filemap = NULL; diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c index 5914b15017..fa845bbf7d 100644 --- a/src/bin/pg_rewind/libpq_fetch.c +++ b/src/bin/pg_rewind/libpq_fetch.c @@ -23,7 +23,7 @@ #include "libpq-fe.h" #include "catalog/catalog.h" -#include "catalog/pg_type.h" +#include "catalog/pg_type_d.h" #include "fe_utils/connect.h" #include "port/pg_bswap.h" diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 8d4f254f9f..577db73f10 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -9,7 +9,7 @@ #include "postgres_fe.h" -#include "catalog/pg_authid.h" +#include "catalog/pg_authid_d.h" #include "fe_utils/string_utils.h" #include "mb/pg_wchar.h" #include "pg_upgrade.h" diff --git a/src/bin/pg_upgrade/function.c b/src/bin/pg_upgrade/function.c index d61fa38c92..03fd155dcd 100644 --- a/src/bin/pg_upgrade/function.c +++ b/src/bin/pg_upgrade/function.c @@ -12,7 +12,7 @@ #include "pg_upgrade.h" #include "access/transam.h" -#include "catalog/pg_language.h" +#include "catalog/pg_language_d.h" /* diff --git a/src/bin/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c index f9f07f491c..fd0b44c3ce 100644 --- a/src/bin/pg_upgrade/info.c +++ b/src/bin/pg_upgrade/info.c @@ -12,7 +12,7 @@ #include "pg_upgrade.h" #include "access/transam.h" -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" static void create_rel_filename_map(const char *old_data, const char *new_data, diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c index cc8e8c94c5..9b2d37f917 100644 --- a/src/bin/pg_upgrade/pg_upgrade.c +++ b/src/bin/pg_upgrade/pg_upgrade.c @@ -37,7 +37,7 @@ #include "postgres_fe.h" #include "pg_upgrade.h" -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "common/file_perm.h" #include "common/restricted_token.h" #include "fe_utils/string_utils.h" diff --git a/src/bin/pg_upgrade/relfilenode.c b/src/bin/pg_upgrade/relfilenode.c index 50bee281f8..ed604f26ca 100644 --- a/src/bin/pg_upgrade/relfilenode.c +++ b/src/bin/pg_upgrade/relfilenode.c @@ -12,7 +12,7 @@ #include "pg_upgrade.h" #include -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "access/transam.h" diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c index 76e9d65537..712ed14339 100644 --- a/src/bin/pg_upgrade/version.c +++ b/src/bin/pg_upgrade/version.c @@ -11,7 +11,7 @@ #include "pg_upgrade.h" -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "fe_utils/string_utils.h" diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 3560318749..4c85f43f09 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -23,7 +23,7 @@ #include /* for stat() */ #endif -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "portability/instr_time.h" #include "libpq-fe.h" diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 75a1e42cee..410131e5c7 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -14,9 +14,9 @@ #include -#include "catalog/pg_attribute.h" -#include "catalog/pg_class.h" -#include "catalog/pg_default_acl.h" +#include "catalog/pg_attribute_d.h" +#include "catalog/pg_class_d.h" +#include "catalog/pg_default_acl_d.h" #include "fe_utils/string_utils.h" #include "common.h" diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 00287bb47f..061de8e6d4 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -41,7 +41,7 @@ #include -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "libpq-fe.h" #include "pqexpbuffer.h" diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 91ebb00f55..60f8b1c394 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -16,7 +16,7 @@ #include #endif -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "common.h" #include "fe_utils/simple_list.h" diff --git a/src/common/relpath.c b/src/common/relpath.c index d98050c590..f0fa6742b3 100644 --- a/src/common/relpath.c +++ b/src/common/relpath.c @@ -19,7 +19,7 @@ #endif #include "catalog/catalog.h" -#include "catalog/pg_tablespace.h" +#include "catalog/pg_tablespace_d.h" #include "common/relpath.h" #include "storage/backendid.h" diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c index ec5ad45a30..cb9a9a0613 100644 --- a/src/fe_utils/print.c +++ b/src/fe_utils/print.c @@ -32,7 +32,7 @@ #include "fe_utils/print.h" -#include "catalog/pg_type.h" +#include "catalog/pg_type_d.h" #include "fe_utils/mbprint.h" diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index bdd25184dc..f38bf343f0 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -5,7 +5,8 @@ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" -#include "pg_type.h" + +#include "catalog/pg_type_d.h" #include "ecpg-pthread-win32.h" #include "ecpgtype.h" diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 0404385de9..c1b44d36f2 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -19,7 +19,7 @@ #include #include -#include "pg_type.h" +#include "catalog/pg_type_d.h" #include "ecpgtype.h" #include "ecpglib.h" diff --git a/src/interfaces/ecpg/ecpglib/pg_type.h b/src/interfaces/ecpg/ecpglib/pg_type.h deleted file mode 100644 index 79a6cf8daa..0000000000 --- a/src/interfaces/ecpg/ecpglib/pg_type.h +++ /dev/null @@ -1,18 +0,0 @@ -/*------------------------------------------------------------------------- - * - * pg_type.h - * Interface to generated type OID symbols. - * - * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * src/interfaces/ecpg/ecpglib/pg_type.h - * - *------------------------------------------------------------------------- - */ -#ifndef PG_TYPE_H -#define PG_TYPE_H - -#include "catalog/pg_type_d.h" - -#endif /* PG_TYPE_H */ diff --git a/src/interfaces/ecpg/ecpglib/sqlda.c b/src/interfaces/ecpg/ecpglib/sqlda.c index c1ba989166..317d22fa4e 100644 --- a/src/interfaces/ecpg/ecpglib/sqlda.c +++ b/src/interfaces/ecpg/ecpglib/sqlda.c @@ -8,7 +8,8 @@ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" -#include "pg_type.h" + +#include "catalog/pg_type_d.h" #include "ecpg-pthread-win32.h" #include "decimal.h" diff --git a/src/interfaces/ecpg/ecpglib/typename.c b/src/interfaces/ecpg/ecpglib/typename.c index 48587e49c7..9da1cdf4c2 100644 --- a/src/interfaces/ecpg/ecpglib/typename.c +++ b/src/interfaces/ecpg/ecpglib/typename.c @@ -3,12 +3,13 @@ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" +#include "catalog/pg_type_d.h" + #include "ecpgtype.h" #include "ecpglib.h" #include "extern.h" #include "sqltypes.h" #include "sql3types.h" -#include "pg_type.h" /* * This function is used to generate the correct type names. diff --git a/src/test/modules/test_rls_hooks/test_rls_hooks.c b/src/test/modules/test_rls_hooks/test_rls_hooks.c index 3e6cedf2bb..cab67a60aa 100644 --- a/src/test/modules/test_rls_hooks/test_rls_hooks.c +++ b/src/test/modules/test_rls_hooks/test_rls_hooks.c @@ -18,16 +18,16 @@ #include "test_rls_hooks.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "catalog/pg_type.h" +#include "nodes/makefuncs.h" +#include "nodes/makefuncs.h" +#include "parser/parse_clause.h" +#include "parser/parse_node.h" +#include "parser/parse_relation.h" +#include "rewrite/rowsecurity.h" +#include "utils/acl.h" +#include "utils/rel.h" +#include "utils/relcache.h" PG_MODULE_MAGIC; diff --git a/src/tools/findoidjoins/findoidjoins.c b/src/tools/findoidjoins/findoidjoins.c index 82ef113e92..cbb7b59adc 100644 --- a/src/tools/findoidjoins/findoidjoins.c +++ b/src/tools/findoidjoins/findoidjoins.c @@ -7,7 +7,7 @@ */ #include "postgres_fe.h" -#include "catalog/pg_class.h" +#include "catalog/pg_class_d.h" #include "fe_utils/connect.h" #include "libpq-fe.h" -- 2.40.0