Support non-btree indexes for foreign keys
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 7 Feb 2025 10:17:25 +0000 (11:17 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 7 Feb 2025 10:23:34 +0000 (11:23 +0100)
commitbfe21b760e039163b91279f58fd09a0298572775
tree0d2f6e56ff11f84225962dded2f7fd0ecf670d6d
parent83ea6c54025bea67bcd4949a6d58d3fc11c3e21b
Support non-btree indexes for foreign keys

Previously, only btrees were supported as the referenced unique index
for foreign keys because there was no way to get the equality strategy
number for other index methods.  We have this now (commit
c09e5a6a016), so we can support this.  In fact, this is now just a
special case of the existing generalized "period" foreign key
support, since that already knows how to lookup equality strategy
numbers.

Note that this does not change the requirement that the referenced
index needs to be unique, and at the moment, only btree supports that,
so this does not change anything in practice, but it would allow
another index method that 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
src/backend/commands/tablecmds.c