Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8c30aca

Browse files
committed
Fix badly broken RelationGetRelationName().
1 parent bbbc00a commit 8c30aca

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/include/utils/rel.h

Lines changed: 6 additions & 5 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.48 2001/06/19 12:03:41 momjian Exp $
10+
* $Id: rel.h,v 1.49 2001/06/19 21:28:41 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -221,9 +221,10 @@ extern void RelationSetIndexSupport(Relation relation,
221221
* Handle temp relations
222222
*/
223223
#define PG_TEMP_REL_PREFIX "pg_temp"
224+
#define PG_TEMP_REL_PREFIX_LEN 7
224225

225226
#define is_temp_relname(relname) \
226-
(strncmp(relname, PG_TEMP_REL_PREFIX, strlen(PG_TEMP_REL_PREFIX)) == 0)
227+
(strncmp(relname, PG_TEMP_REL_PREFIX, PG_TEMP_REL_PREFIX_LEN) == 0)
227228

228229
/*
229230
* RelationGetPhysicalRelationName
@@ -252,12 +253,12 @@ extern void RelationSetIndexSupport(Relation relation,
252253
*/
253254
#define RelationGetRelationName(relation) \
254255
(\
255-
!is_temp_relname(relation) \
256+
is_temp_relname(RelationGetPhysicalRelationName(relation)) \
256257
? \
257-
RelationGetPhysicalRelationName(relation) \
258-
: \
259258
get_temp_rel_by_physicalname( \
260259
RelationGetPhysicalRelationName(relation)) \
260+
: \
261+
RelationGetPhysicalRelationName(relation) \
261262
)
262263

263264

0 commit comments

Comments
 (0)