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

Commite846fc4

Browse files
committed
Check collation when creating partitioned index
When creating a partitioned index, the partition key must be a subsetof the index's columns. But this currently doesn't check that thecollations between the partition key and the index definition match.So you can construct a unique index that fails to enforce uniqueness.(This would most likely involve a nondeterministic collation, so itwould have to be crafted explicitly and is not something that wouldjust happen by accident.)This patch adds the required collation check. As a result, anypreviously allowed unique index that has a collation mismatch would nolonger be allowed to be created.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://www.postgresql.org/message-id/flat/3327cb54-f7f1-413b-8fdb-7a9dceebb938%40eisentraut.org
1 parent1a4d714 commite846fc4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/backend/commands/indexcmds.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,10 +1012,13 @@ DefineIndex(Oid relationId,
10121012
{
10131013
if (key->partattrs[i]==indexInfo->ii_IndexAttrNumbers[j])
10141014
{
1015-
/* Matched the column, now what about the equality op? */
1015+
/* Matched the column, now what about thecollation andequality op? */
10161016
Oididx_opfamily;
10171017
Oididx_opcintype;
10181018

1019+
if (key->partcollation[i]!=collationObjectId[j])
1020+
continue;
1021+
10191022
if (get_opclass_opfamily_and_input_type(classObjectId[j],
10201023
&idx_opfamily,
10211024
&idx_opcintype))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp