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

Commit05cd91a

Browse files
committed
typeTypeName() must return a pstrdup'd copy of the type name, not a
direct pointer into the syscache entry for the type. In some casesthe syscache entry might get flushed before we are done using thereturned type name. This bug accounts for difficult-to-repeatfailures seen when INSERTs into columns of certain data types arerun in parallel with VACUUMs of system tables. There may be relatedproblems elsewhere --- we need to take a harder look at uses ofsyscache data.
1 parent4032a51 commit05cd91a

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.30 2000/05/30 04:24:49 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.31 2000/06/06 16:50:37 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -48,7 +48,8 @@ typeidTypeName(Oid id)
4848
returnNULL;
4949
}
5050
typetuple= (Form_pg_type)GETSTRUCT(tup);
51-
returnNameStr(typetuple->typname);
51+
/* pstrdup here because result may need to outlive the syscache entry */
52+
returnpstrdup(NameStr(typetuple->typname));
5253
}
5354

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

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp