diff options
author | Bruce Momjian <bruce@momjian.us> | 2001-06-19 12:03:41 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2001-06-19 12:03:41 +0000 |
commit | d9a069e2242b360351df39687a956bf278607b7a (patch) | |
tree | 9d2e52db775f2614a7d38943bdc589aaf886d367 | |
parent | d47e10bfde24d0aa2ba11e17b728495534cd44d7 (diff) | |
download | postgresql-d9a069e2242b360351df39687a956bf278607b7a.tar.gz postgresql-d9a069e2242b360351df39687a956bf278607b7a.zip |
Move temprel name define from temprel.h to rel.h.
-rw-r--r-- | src/include/utils/rel.h | 83 | ||||
-rw-r--r-- | src/include/utils/temprel.h | 7 |
2 files changed, 46 insertions, 44 deletions
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index b826ac0249d..51832c6f3ee 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: rel.h,v 1.47 2001/06/19 05:11:50 tgl Exp $ + * $Id: rel.h,v 1.48 2001/06/19 12:03:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -188,43 +188,6 @@ typedef Relation *RelationPtr; #define RelationGetFile(relation) ((relation)->rd_fd) /* - * RelationGetRelationName - * - * Returns the relation's logical name (as seen by the user). - * - * If the rel is a temp rel, the temp name will be returned. Therefore, - * this name is not unique. But it is the name to use in heap_openr(), - * for example. - */ -#define RelationGetRelationName(relation) \ -(\ - (strncmp(RelationGetPhysicalRelationName(relation), \ - "pg_temp", 7) != 0) \ - ? \ - RelationGetPhysicalRelationName(relation) \ - : \ - get_temp_rel_by_physicalname( \ - RelationGetPhysicalRelationName(relation)) \ -) - - -/* - * RelationGetPhysicalRelationName - * - * Returns the rel's physical name, ie, the name appearing in pg_class. - * - * While this name is unique across all rels in the database, it is not - * necessarily useful for accessing the rel, since a temp table of the - * same name might mask the rel. It is useful mainly for determining if - * the rel is a shared system rel or not. - * - * The macro is rather unfortunately named, since the pg_class name no longer - * has anything to do with the file name used for physical storage of the rel. - */ -#define RelationGetPhysicalRelationName(relation) \ - (NameStr((relation)->rd_rel->relname)) - -/* * RelationGetNumberOfAttributes * * Returns the number of attributes. @@ -254,4 +217,48 @@ extern void RelationSetIndexSupport(Relation relation, IndexStrategy strategy, RegProcedure *support); +/* + * Handle temp relations + */ +#define PG_TEMP_REL_PREFIX "pg_temp" + +#define is_temp_relname(relname) \ + (strncmp(relname, PG_TEMP_REL_PREFIX, strlen(PG_TEMP_REL_PREFIX)) == 0) + +/* + * RelationGetPhysicalRelationName + * + * Returns the rel's physical name, ie, the name appearing in pg_class. + * + * While this name is unique across all rels in the database, it is not + * necessarily useful for accessing the rel, since a temp table of the + * same name might mask the rel. It is useful mainly for determining if + * the rel is a shared system rel or not. + * + * The macro is rather unfortunately named, since the pg_class name no longer + * has anything to do with the file name used for physical storage of the rel. + */ +#define RelationGetPhysicalRelationName(relation) \ + (NameStr((relation)->rd_rel->relname)) + +/* + * RelationGetRelationName + * + * Returns the relation's logical name (as seen by the user). + * + * If the rel is a temp rel, the temp name will be returned. Therefore, + * this name is not unique. But it is the name to use in heap_openr(), + * for example. + */ +#define RelationGetRelationName(relation) \ +(\ + !is_temp_relname(relation) \ + ? \ + RelationGetPhysicalRelationName(relation) \ + : \ + get_temp_rel_by_physicalname( \ + RelationGetPhysicalRelationName(relation)) \ +) + + #endif /* REL_H */ diff --git a/src/include/utils/temprel.h b/src/include/utils/temprel.h index b185e3372e9..f503850e4e4 100644 --- a/src/include/utils/temprel.h +++ b/src/include/utils/temprel.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: temprel.h,v 1.16 2001/06/18 16:13:21 momjian Exp $ + * $Id: temprel.h,v 1.17 2001/06/19 12:03:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -16,11 +16,6 @@ #include "access/htup.h" -#define PG_TEMP_REL_PREFIX "pg_temp" - -#define is_temp_relname(relname) \ - (strncmp(relname, PG_TEMP_REL_PREFIX, strlen(PG_TEMP_REL_PREFIX)) == 0) - extern void create_temp_relation(const char *relname, HeapTuple pg_class_tuple); extern void remove_temp_rel_by_relid(Oid relid); |