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

Commitb92c033

Browse files
peteremarkdilger
andcommitted
Allow non-btree speculative insertion indexes
Previously, only btrees were supported as the arbiter index forspeculative insertion because there was no way to get the equalitystrategy number for other index methods. We have this now (commitc09e5a6), so we can support this.At the moment, only btree supports unique indexes, so this does notchange anything in practice, but it would allow another index methodthat has amcanunique to be supported.Co-authored-by: Mark Dilger <mark.dilger@enterprisedb.com>Discussion:https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
1 parentbfe21b7 commitb92c033

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/backend/catalog/index.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2677,9 +2677,6 @@ BuildSpeculativeIndexInfo(Relation index, IndexInfo *ii)
26772677
*/
26782678
Assert(ii->ii_Unique);
26792679

2680-
if (index->rd_rel->relam!=BTREE_AM_OID)
2681-
elog(ERROR,"unexpected non-btree speculative unique index");
2682-
26832680
ii->ii_UniqueOps= (Oid*)palloc(sizeof(Oid)*indnkeyatts);
26842681
ii->ii_UniqueProcs= (Oid*)palloc(sizeof(Oid)*indnkeyatts);
26852682
ii->ii_UniqueStrats= (uint16*)palloc(sizeof(uint16)*indnkeyatts);
@@ -2691,7 +2688,12 @@ BuildSpeculativeIndexInfo(Relation index, IndexInfo *ii)
26912688
/* We need the func OIDs and strategy numbers too */
26922689
for (i=0;i<indnkeyatts;i++)
26932690
{
2694-
ii->ii_UniqueStrats[i]=BTEqualStrategyNumber;
2691+
ii->ii_UniqueStrats[i]=
2692+
IndexAmTranslateCompareType(COMPARE_EQ,
2693+
index->rd_rel->relam,
2694+
index->rd_opfamily[i],
2695+
index->rd_opcintype[i],
2696+
false);
26952697
ii->ii_UniqueOps[i]=
26962698
get_opfamily_member(index->rd_opfamily[i],
26972699
index->rd_opcintype[i],

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp