summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBruce Momjian1999-11-16 04:14:03 +0000
committerBruce Momjian1999-11-16 04:14:03 +0000
commitdc5c7713bcd620e4b8cee6c282e55afdd2a97749 (patch)
tree382583a4058b773bade83ea5c40e4a63dc720830 /src/include
parentbf5d51e7fe1ecc6d6aaf24d37ea29904194e32a2 (diff)
Commit to make clearer distinction for temp names and real names.
Thanks to Tom Lane for ideas.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/utils/rel.h24
-rw-r--r--src/include/utils/temprel.h5
2 files changed, 24 insertions, 5 deletions
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index b22ad294cea..689d5d02950 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.29 1999/11/07 23:08:33 momjian Exp $
+ * $Id: rel.h,v 1.30 1999/11/16 04:14:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,7 +20,6 @@
#include "rewrite/prs2lock.h"
#include "storage/fd.h"
-
/*
* LockRelId and LockInfo really belong to lmgr.h, but it's more convenient
* to declare them here so we can have a LockInfoData field in a Relation.
@@ -176,7 +175,26 @@ typedef Relation *RelationPtr;
*
* Returns a Relation Name
*/
-#define RelationGetRelationName(relation) (NameStr((relation)->rd_rel->relname))
+/* added to prevent circular dependency. bjm 1999/11/15 */
+char *get_temp_rel_by_physicalname(char *relname);
+#define RelationGetRelationName(relation) \
+(\
+ (strncmp(RelationGetPhysicalRelationName(relation), \
+ "pg_temp.", strlen("pg_temp.")) != 0) \
+ ? \
+ RelationGetPhysicalRelationName(relation) \
+ : \
+ get_temp_rel_by_physicalname( \
+ RelationGetPhysicalRelationName(relation)) \
+)
+
+
+/*
+ * RelationGetPhysicalRelationName
+ *
+ * Returns a Relation Name
+ */
+#define RelationGetPhysicalRelationName(relation) (NameStr((relation)->rd_rel->relname))
/*
* RelationGetNumberOfAttributes
diff --git a/src/include/utils/temprel.h b/src/include/utils/temprel.h
index 248a6e134e0..39e5157bd4b 100644
--- a/src/include/utils/temprel.h
+++ b/src/include/utils/temprel.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: temprel.h,v 1.5 1999/09/04 19:55:50 momjian Exp $
+ * $Id: temprel.h,v 1.6 1999/11/16 04:14:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,6 +19,7 @@ void create_temp_relation(char *relname, HeapTuple pg_class_tuple);
void remove_all_temp_relations(void);
void invalidate_temp_relations(void);
void remove_temp_relation(Oid relid);
-char *get_temp_rel_by_name(char *user_relname);
+char *get_temp_rel_by_username(char *user_relname);
+char *get_temp_rel_by_physicalname(char *relname);
#endif /* TEMPREL_H */