From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: John Naylor <jcnaylor@gmail.com>
Subject: Mop-up for the bootstrap data conversion patch
Date: Fri, 06 Apr 2018 12:22:57 -0400
Message-ID: <23690.1523031777@sss.pgh.pa.us> (raw)
Those of you who've been paying attention to the bootstrap data conversion
thread will know that one of the key ideas is to put everything in the
catalog headers that's of direct use to client-side code into separate
"pg_foo_d.h" headers. This allows clients to include pg_foo_d.h to get
OID macros or whatever else they need, and not have to worry about whether
the main pg_foo.h header contains backend-only declarations.
Attached is a patch that changes all our frontend code to actually do
things that way. I propose to push this after the bootstrap conversion
proper.
In the wake of these changes, it'd be possible to reverse the changes
we've made to move extern declarations for backend/catalog/pg_foo.c
functions into separate pg_foo_fn.h headers, which we've done whenever
(a) such externs required backend-only typedefs and (b) we really needed
pg_foo.h to be includable by frontend code. So it's time to make a
decision whether we want to do that, or leave well enough alone.
I've always felt that the pg_foo_fn.h business was a kluge, and would
be happy to get rid of it. But one could also argue that it would be
a good design, if we adopted it uniformly instead of haphazardly.
But that'd require more code churn, and there's no longer a lot to be
gained thereby.
Another approach worth discussing is "let's do that, but wait a release
or two to give third-party clients time to adjust to using pg_foo_d.h".
I'm not excited by that though. I think third parties will just wait to
change till they're forced to, so this wouldn't really reduce the pain
only delay it. Plus I don't know that we'd ever get around to it;
our track record for doing cleanup things later isn't great.
So I feel that we should either strike while the iron is hot, and
re-merge the pg_foo_fn.h headers now, or decide that we're never
going to do that and we'll just let them be as-is.
Thoughts?
regards, tom lane
PS: forgot to mention: this patch also gets rid of ecpglib/pg_type.h
entirely, as it's now just a confusingly-named wrapper for pg_type_d.h.
Attachments:bootstrap-client-fixes-1.patch (text/x-diff, 10.6K) downloaddiff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.cindex 769e527..63e360c 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.cindex ab6b17c..7eb474c 100644--- a/contrib/vacuumlo/vacuumlo.c+++ b/contrib/vacuumlo/vacuumlo.c@@ -21,7 +21,7 @@
#include <termios.h>
#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.cindex 78990f5..2dbdd3e 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_utils.h"
#include "common/restricted_token.h"
#include "common/username.h"
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.cindex 0a758f1..e7db78b 100644--- a/src/bin/pg_dump/common.c+++ b/src/bin/pg_dump/common.c@@ -21,7 +21,7 @@
#include <ctype.h>
-#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.cindex d066f4f..5d28c82 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.cindex 5ce3c5d..d2b0949 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.cindex 876a62a..c3fc519 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.cindex 5914b15..fa845bb 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.cindex 8d4f254..577db73 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.cindex d61fa38..03fd155 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.cindex f9f07f4..fd0b44c 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.cindex d124127..16e0181 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/restricted_token.h"
#include "fe_utils/string_utils.h"
diff --git a/src/bin/pg_upgrade/relfilenode.c b/src/bin/pg_upgrade/relfilenode.cindex 50bee28..ed604f2 100644--- a/src/bin/pg_upgrade/relfilenode.c+++ b/src/bin/pg_upgrade/relfilenode.c@@ -12,7 +12,7 @@
#include "pg_upgrade.h"
#include <sys/stat.h>
-#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.cindex 76e9d65..712ed14 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.cindex 3560318..4c85f43 100644--- a/src/bin/psql/command.c+++ b/src/bin/psql/command.c@@ -23,7 +23,7 @@
#include <sys/stat.h> /* 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.cindex 0c3be1f..de43886 100644--- a/src/bin/psql/describe.c+++ b/src/bin/psql/describe.c@@ -14,9 +14,9 @@
#include <ctype.h>
-#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.cindex 00287bb..061de8e 100644--- a/src/bin/psql/tab-complete.c+++ b/src/bin/psql/tab-complete.c@@ -41,7 +41,7 @@
#include <ctype.h>
-#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.cindex 91ebb00..60f8b1c 100644--- a/src/bin/scripts/vacuumdb.c+++ b/src/bin/scripts/vacuumdb.c@@ -16,7 +16,7 @@
#include <sys/select.h>
#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.cindex d98050c..f0fa674 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.cindex ec5ad45..cb9a9a0 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.cindex bdd2518..f38bf34 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.cindex 0404385..c1b44d3 100644--- a/src/interfaces/ecpg/ecpglib/execute.c+++ b/src/interfaces/ecpg/ecpglib/execute.c@@ -19,7 +19,7 @@
#include <float.h>
#include <math.h>
-#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.hindex 79a6cf8..e69de29 100644--- a/src/interfaces/ecpg/ecpglib/pg_type.h+++ b/src/interfaces/ecpg/ecpglib/pg_type.h@@ -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.cindex c1ba989..317d22f 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.cindex 48587e4..9da1cdf 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/tools/findoidjoins/findoidjoins.c b/src/tools/findoidjoins/findoidjoins.cindex 82ef113..cbb7b59 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"
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org, jcnaylor@gmail.com
Subject: Re: Mop-up for the bootstrap data conversion patch
In-Reply-To: <23690.1523031777@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox