mirror of
https://github.com/postgres/postgres.git
synced 2026-04-27 17:16:43 -04:00
Commit a730183926 created rather a mess by
putting dependencies on backend-only include files into include/common.
We really shouldn't do that. To clean it up:
* Move TABLESPACE_VERSION_DIRECTORY back to its longtime home in
catalog/catalog.h. We won't consider this symbol part of the FE/BE API.
* Push enum ForkNumber from relfilenode.h into relpath.h. We'll consider
relpath.h as the source of truth for fork numbers, since relpath.c was
already partially serving that function, and anyway relfilenode.h was
kind of a random place for that enum.
* So, relfilenode.h now includes relpath.h rather than vice-versa. This
direction of dependency is fine. (That allows most, but not quite all,
of the existing explicit #includes of relpath.h to go away again.)
* Push forkname_to_number from catalog.c to relpath.c, just to centralize
fork number stuff a bit better.
* Push GetDatabasePath from catalog.c to relpath.c; it was rather odd
that the previous commit didn't keep this together with relpath().
* To avoid needing relfilenode.h in common/, redefine the underlying
function (now called GetRelationPath) as taking separate OID arguments,
and make the APIs using RelFileNode or RelFileNodeBackend into macro
wrappers. (The macros have a potential multiple-eval risk, but none of
the existing call sites have an issue with that; one of them had such a
risk already anyway.)
* Fix failure to follow the directions when "init" fork type was added;
specifically, the errhint in forkname_to_number wasn't updated, and neither
was the SGML documentation for pg_relation_size().
* Fix tablespace-path-too-long check in CreateTableSpace() to account for
fork-name component of maximum-length pathnames. This requires putting
FORKNAMECHARS into a header file, but it was rather useless (and
actually unreferenced) where it was.
The last couple of items are potentially back-patchable bug fixes,
if anyone is sufficiently excited about them; but personally I'm not.
Per a gripe from Christoph Berg about how include/common wasn't
self-contained.
51 lines
1.6 KiB
C
51 lines
1.6 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* catalog.h
|
|
* prototypes for functions in backend/catalog/catalog.c
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/catalog/catalog.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#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);
|
|
extern bool IsCatalogRelation(Relation relation);
|
|
|
|
extern bool IsSystemClass(Oid relid, Form_pg_class reltuple);
|
|
extern bool IsToastClass(Form_pg_class reltuple);
|
|
extern bool IsCatalogClass(Oid relid, Form_pg_class reltuple);
|
|
|
|
extern bool IsSystemNamespace(Oid namespaceId);
|
|
extern bool IsToastNamespace(Oid namespaceId);
|
|
|
|
extern bool IsReservedName(const char *name);
|
|
|
|
extern bool IsSharedRelation(Oid relationId);
|
|
|
|
extern Oid GetNewOid(Relation relation);
|
|
extern Oid GetNewOidWithIndex(Relation relation, Oid indexId,
|
|
AttrNumber oidcolumn);
|
|
extern Oid GetNewRelFileNode(Oid reltablespace, Relation pg_class,
|
|
char relpersistence);
|
|
|
|
#endif /* CATALOG_H */
|