]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Back-patch typeTypeName() fix into REL7_0.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 6 Jun 2000 16:51:24 +0000 (16:51 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 6 Jun 2000 16:51:24 +0000 (16:51 +0000)
src/backend/parser/parse_type.c

index 3fc2c623fd5b903a7aa5aada732bf4484d71276f..cf14edf36c4d3d7b272e61fd4b5cd17367a000da 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.29 2000/01/26 05:56:42 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.29.2.1 2000/06/06 16:51:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -48,7 +48,8 @@ typeidTypeName(Oid id)
                return NULL;
        }
        typetuple = (Form_pg_type) GETSTRUCT(tup);
-       return NameStr(typetuple->typname);
+       /* pstrdup here because result may need to outlive the syscache entry */
+       return pstrdup(NameStr(typetuple->typname));
 }
 
 /* return a Type structure, given a type id */
@@ -119,7 +120,8 @@ typeTypeName(Type t)
        Form_pg_type typ;
 
        typ = (Form_pg_type) GETSTRUCT(t);
-       return NameStr(typ->typname);
+       /* pstrdup here because result may need to outlive the syscache entry */
+       return pstrdup(NameStr(typ->typname));
 }
 
 /* given a type, return its typetype ('c' for 'c'atalog types) */