Skip to content

Commit 91ccad9

Browse files
committed
Back-patch typeTypeName() fix into REL7_0.
1 parent e261306 commit 91ccad9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/backend/parser/parse_type.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.29 2000/01/26 05:56:42 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.29.2.1 2000/06/06 16:51:24 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -48,7 +48,8 @@ typeidTypeName(Oid id)
4848
return NULL;
4949
}
5050
typetuple = (Form_pg_type) GETSTRUCT(tup);
51-
return NameStr(typetuple->typname);
51+
/* pstrdup here because result may need to outlive the syscache entry */
52+
return pstrdup(NameStr(typetuple->typname));
5253
}
5354

5455
/* return a Type structure, given a type id */
@@ -119,7 +120,8 @@ typeTypeName(Type t)
119120
Form_pg_type typ;
120121

121122
typ = (Form_pg_type) GETSTRUCT(t);
122-
return NameStr(typ->typname);
123+
/* pstrdup here because result may need to outlive the syscache entry */
124+
return pstrdup(NameStr(typ->typname));
123125
}
124126

125127
/* given a type, return its typetype ('c' for 'c'atalog types) */

0 commit comments

Comments
 (0)