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

Commit5b5ee14

Browse files
committed
Add a defense to prevent storing pseudo-type data into index columns.
Formerly, the lack of any opclasses that could accept such data was enoughof a defense, but now with a "record" opclass we need to check more carefully.(You can still use that opclass for an index, but you have to store a namedcomposite type not an anonymous one.)
1 parent2f0d528 commit5b5ee14

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎src/backend/catalog/index.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.305 2008/09/30 10:52:12 heikki Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.306 2008/10/14 21:47:39 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -236,6 +236,17 @@ ConstructTupleDescriptor(Relation heapRelation,
236236
to->attislocal= true;
237237

238238
ReleaseSysCache(tuple);
239+
240+
/*
241+
* Make sure the expression yields a type that's safe to store in
242+
* an index. We need this defense because we have index opclasses
243+
* for pseudo-types such as "record", and the actually stored type
244+
* had better be safe; eg, a named composite type is okay, an
245+
* anonymous record type is not. The test is the same as for
246+
* whether a table column is of a safe type (which is why we
247+
* needn't check for the non-expression case).
248+
*/
249+
CheckAttributeType(NameStr(to->attname),to->atttypid);
239250
}
240251

241252
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp