mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Move relpath() to libpgcommon
This enables non-backend code, such as pg_xlogdump, to use it easily. The previous location, in src/backend/catalog/catalog.c, made that essentially impossible because that file depends on many backend-only facilities; so this needs to live separately.
This commit is contained in:
@@ -14,34 +14,14 @@
|
||||
#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 "storage/relfilenode.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 const char *forkNames[];
|
||||
extern ForkNumber forkname_to_number(char *forkName);
|
||||
extern int forkname_chars(const char *str, ForkNumber *);
|
||||
|
||||
extern char *relpathbackend(RelFileNode rnode, BackendId backend,
|
||||
ForkNumber forknum);
|
||||
extern char *GetDatabasePath(Oid dbNode, Oid spcNode);
|
||||
|
||||
/* First argument is a RelFileNodeBackend */
|
||||
#define relpath(rnode, forknum) \
|
||||
relpathbackend((rnode).node, (rnode).backend, (forknum))
|
||||
|
||||
/* First argument is a RelFileNode */
|
||||
#define relpathperm(rnode, forknum) \
|
||||
relpathbackend((rnode), InvalidBackendId, (forknum))
|
||||
|
||||
extern bool IsSystemRelation(Relation relation);
|
||||
extern bool IsToastRelation(Relation relation);
|
||||
|
41
src/include/common/relpath.h
Normal file
41
src/include/common/relpath.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* relpath.h
|
||||
* Declarations for relpath() and friends
|
||||
*
|
||||
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/common/relpath.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#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 */
|
||||
#include "storage/relfilenode.h"
|
||||
|
||||
|
||||
#define OIDCHARS 10 /* max chars printed by %u */
|
||||
#define TABLESPACE_VERSION_DIRECTORY "PG_" PG_MAJORVERSION "_" \
|
||||
CppAsString2(CATALOG_VERSION_NO)
|
||||
|
||||
extern const char *forkNames[];
|
||||
extern int forkname_chars(const char *str, ForkNumber *fork);
|
||||
extern char *relpathbackend(RelFileNode rnode, BackendId backend,
|
||||
ForkNumber forknum);
|
||||
|
||||
/* First argument is a RelFileNodeBackend */
|
||||
#define relpath(rnode, forknum) \
|
||||
relpathbackend((rnode).node, (rnode).backend, (forknum))
|
||||
|
||||
/* First argument is a RelFileNode */
|
||||
#define relpathperm(rnode, forknum) \
|
||||
relpathbackend((rnode), InvalidBackendId, (forknum))
|
||||
|
||||
#endif /* RELPATH_H */
|
Reference in New Issue
Block a user