Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd9a069e

Browse files
committed
Move temprel name define from temprel.h to rel.h.
1 parentd47e10b commitd9a069e

File tree

2 files changed

+46
-44
lines changed

2 files changed

+46
-44
lines changed

‎src/include/utils/rel.h

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: rel.h,v 1.47 2001/06/1905:11:50 tgl Exp $
10+
* $Id: rel.h,v 1.48 2001/06/1912:03:41 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -187,43 +187,6 @@ typedef Relation *RelationPtr;
187187
*/
188188
#defineRelationGetFile(relation) ((relation)->rd_fd)
189189

190-
/*
191-
* RelationGetRelationName
192-
*
193-
* Returns the relation's logical name (as seen by the user).
194-
*
195-
* If the rel is a temp rel, the temp name will be returned. Therefore,
196-
* this name is not unique. But it is the name to use in heap_openr(),
197-
* for example.
198-
*/
199-
#defineRelationGetRelationName(relation) \
200-
(\
201-
(strncmp(RelationGetPhysicalRelationName(relation), \
202-
"pg_temp", 7) != 0) \
203-
? \
204-
RelationGetPhysicalRelationName(relation) \
205-
: \
206-
get_temp_rel_by_physicalname( \
207-
RelationGetPhysicalRelationName(relation)) \
208-
)
209-
210-
211-
/*
212-
* RelationGetPhysicalRelationName
213-
*
214-
* Returns the rel's physical name, ie, the name appearing in pg_class.
215-
*
216-
* While this name is unique across all rels in the database, it is not
217-
* necessarily useful for accessing the rel, since a temp table of the
218-
* same name might mask the rel. It is useful mainly for determining if
219-
* the rel is a shared system rel or not.
220-
*
221-
* The macro is rather unfortunately named, since the pg_class name no longer
222-
* has anything to do with the file name used for physical storage of the rel.
223-
*/
224-
#defineRelationGetPhysicalRelationName(relation) \
225-
(NameStr((relation)->rd_rel->relname))
226-
227190
/*
228191
* RelationGetNumberOfAttributes
229192
*
@@ -254,4 +217,48 @@ extern void RelationSetIndexSupport(Relation relation,
254217
IndexStrategystrategy,
255218
RegProcedure*support);
256219

220+
/*
221+
* Handle temp relations
222+
*/
223+
#definePG_TEMP_REL_PREFIX "pg_temp"
224+
225+
#defineis_temp_relname(relname) \
226+
(strncmp(relname, PG_TEMP_REL_PREFIX, strlen(PG_TEMP_REL_PREFIX)) == 0)
227+
228+
/*
229+
* RelationGetPhysicalRelationName
230+
*
231+
* Returns the rel's physical name, ie, the name appearing in pg_class.
232+
*
233+
* While this name is unique across all rels in the database, it is not
234+
* necessarily useful for accessing the rel, since a temp table of the
235+
* same name might mask the rel. It is useful mainly for determining if
236+
* the rel is a shared system rel or not.
237+
*
238+
* The macro is rather unfortunately named, since the pg_class name no longer
239+
* has anything to do with the file name used for physical storage of the rel.
240+
*/
241+
#defineRelationGetPhysicalRelationName(relation) \
242+
(NameStr((relation)->rd_rel->relname))
243+
244+
/*
245+
* RelationGetRelationName
246+
*
247+
* Returns the relation's logical name (as seen by the user).
248+
*
249+
* If the rel is a temp rel, the temp name will be returned. Therefore,
250+
* this name is not unique. But it is the name to use in heap_openr(),
251+
* for example.
252+
*/
253+
#defineRelationGetRelationName(relation) \
254+
(\
255+
!is_temp_relname(relation) \
256+
? \
257+
RelationGetPhysicalRelationName(relation) \
258+
: \
259+
get_temp_rel_by_physicalname( \
260+
RelationGetPhysicalRelationName(relation)) \
261+
)
262+
263+
257264
#endif/* REL_H */

‎src/include/utils/temprel.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: temprel.h,v 1.16 2001/06/18 16:13:21 momjian Exp $
10+
* $Id: temprel.h,v 1.17 2001/06/19 12:03:41 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -16,11 +16,6 @@
1616

1717
#include"access/htup.h"
1818

19-
#definePG_TEMP_REL_PREFIX "pg_temp"
20-
21-
#defineis_temp_relname(relname) \
22-
(strncmp(relname, PG_TEMP_REL_PREFIX, strlen(PG_TEMP_REL_PREFIX)) == 0)
23-
2419
externvoidcreate_temp_relation(constchar*relname,
2520
HeapTuplepg_class_tuple);
2621
externvoidremove_temp_rel_by_relid(Oidrelid);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp