Commit af1a9491 authored by Tom Lane's avatar Tom Lane

Further cleanup of client dependencies on src/include/catalog headers.

In commit 9c0a0de4, I'd failed to notice that catalog/catalog.h
should also be considered a frontend-unsafe header, because it includes
(and needs) the full form of pg_class.h, not to mention relcache.h.
However, various frontend code was depending on it to get
TABLESPACE_VERSION_DIRECTORY, so refactoring of some sort is called for.

The cleanest answer seems to be to move TABLESPACE_VERSION_DIRECTORY,
as well as the OIDCHARS symbol, to common/relpath.h.  Do that, and mop up
inclusions as necessary.  (I found that quite a few current users of
catalog/catalog.h don't seem to need it at all anymore, apparently as a
result of the refactorings that created common/relpath.[hc].  And
initdb.c needed it only as a route to pg_class_d.h.)

Discussion: https://postgr.es/m/6629.1523294509@sss.pgh.pa.us
parent f5543d47
......@@ -18,7 +18,6 @@
#include "pageinspect.h"
#include "access/htup_details.h"
#include "catalog/catalog.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
......
......@@ -16,7 +16,6 @@
#include <unistd.h>
#include "access/heapam.h"
#include "catalog/catalog.h"
#include "fmgr.h"
#include "miscadmin.h"
#include "storage/bufmgr.h"
......
......@@ -73,7 +73,6 @@
#include "access/relscan.h"
#include "access/transam.h"
#include "access/xlog.h"
#include "catalog/catalog.h"
#include "catalog/index.h"
#include "pgstat.h"
#include "storage/bufmgr.h"
......
......@@ -14,7 +14,6 @@
*/
#include "postgres.h"
#include "catalog/catalog.h"
#include "catalog/storage_xlog.h"
......
......@@ -16,7 +16,6 @@
#include "access/transam.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "storage/sinval.h"
#include "storage/standbydefs.h"
#include "utils/timestamp.h"
......
......@@ -30,7 +30,6 @@
#include "access/xlog.h"
#include "access/xloginsert.h"
#include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "catalog/namespace.h"
#include "catalog/storage.h"
#include "commands/async.h"
......
......@@ -20,7 +20,6 @@
#include "access/xlog.h"
#include "access/xlog_internal.h"
#include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
......
......@@ -23,7 +23,6 @@
#include "access/xlog.h"
#include "access/xlog_internal.h"
#include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "storage/smgr.h"
......
......@@ -24,7 +24,6 @@
#include "access/xlog.h"
#include "access/xloginsert.h"
#include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "storage/freespace.h"
......
......@@ -44,7 +44,6 @@
#include "access/transam.h"
#include "access/visibilitymap.h"
#include "access/xlog.h"
#include "catalog/catalog.h"
#include "catalog/storage.h"
#include "commands/dbcommands.h"
#include "commands/progress.h"
......
......@@ -17,7 +17,6 @@
#include <time.h>
#include "access/xlog_internal.h" /* for pg_start/stop_backup */
#include "catalog/catalog.h"
#include "catalog/pg_type.h"
#include "common/file_perm.h"
#include "lib/stringinfo.h"
......
......@@ -82,7 +82,6 @@
#include "miscadmin.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "catalog/catalog.h"
#include "catalog/pg_tablespace.h"
#include "common/file_perm.h"
#include "pgstat.h"
......
......@@ -16,7 +16,6 @@
#include <unistd.h>
#include "catalog/catalog.h"
#include "common/relpath.h"
#include "storage/copydir.h"
#include "storage/fd.h"
......
......@@ -27,7 +27,6 @@
#include "miscadmin.h"
#include "access/xlog.h"
#include "catalog/catalog.h"
#include "pgstat.h"
#include "portability/instr_time.h"
#include "postmaster/bgwriter.h"
......
......@@ -60,8 +60,8 @@
#endif
#include "access/xlog_internal.h"
#include "catalog/catalog.h"
#include "catalog/pg_authid_d.h"
#include "catalog/pg_class_d.h" /* pgrminclude ignore */
#include "catalog/pg_collation_d.h"
#include "common/file_perm.h"
#include "common/file_utils.h"
......
......@@ -21,8 +21,6 @@
#include "logging.h"
#include "pg_rewind.h"
#include "catalog/catalog.h"
static void recurse_dir(const char *datadir, const char *path,
process_file_callback_t callback);
......
......@@ -19,7 +19,6 @@
#include "pg_rewind.h"
#include "common/string.h"
#include "catalog/catalog.h"
#include "catalog/pg_tablespace_d.h"
#include "storage/fd.h"
......
......@@ -22,7 +22,6 @@
#include "logging.h"
#include "libpq-fe.h"
#include "catalog/catalog.h"
#include "catalog/pg_type_d.h"
#include "fe_utils/connect.h"
#include "port/pg_bswap.h"
......
......@@ -18,7 +18,6 @@
#include "postgres_fe.h"
#endif
#include "catalog/catalog.h"
#include "catalog/pg_tablespace_d.h"
#include "common/relpath.h"
#include "storage/backendid.h"
......
......@@ -14,18 +14,9 @@
#ifndef CATALOG_H
#define CATALOG_H
/*
* 'pgrminclude ignore' needed here because CppAsString2() does not throw
* an error if the symbol is not defined.
*/
#include "catalog/catversion.h" /* pgrminclude ignore */
#include "catalog/pg_class.h"
#include "utils/relcache.h"
#define OIDCHARS 10 /* max chars printed by %u */
#define TABLESPACE_VERSION_DIRECTORY "PG_" PG_MAJORVERSION "_" \
CppAsString2(CATALOG_VERSION_NO)
extern bool IsSystemRelation(Relation relation);
extern bool IsToastRelation(Relation relation);
......
......@@ -13,6 +13,22 @@
#ifndef RELPATH_H
#define RELPATH_H
/*
* 'pgrminclude ignore' needed here because CppAsString2() does not throw
* an error if the symbol is not defined.
*/
#include "catalog/catversion.h" /* pgrminclude ignore */
/*
* Name of major-version-specific tablespace subdirectories
*/
#define TABLESPACE_VERSION_DIRECTORY "PG_" PG_MAJORVERSION "_" \
CppAsString2(CATALOG_VERSION_NO)
/* Characters to allow for an OID in a relation path */
#define OIDCHARS 10 /* max chars printed by %u */
/*
* Stuff for fork names.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment