Skip to content

Commit 97b7863

Browse files
committed
fix: add explicit type cast to resolve operator ambiguity in i3
Add explicit `::int2[]` cast to `key_cols` parameter in the i3 foreign key check query. This resolves "operator is not unique" errors that can occur in certain PostgreSQL environments (such as Google CloudSQL). The error occurs when PostgreSQL cannot determine which @> operator to use between smallint[] operands. By explicitly casting both sides to int2[], we eliminate any ambiguity. While standard PostgreSQL installations (including those with intarray extension) may not exhibit this error, the explicit cast is a best practice that ensures consistent behavior across all environments. Fixes #62
1 parent d9f648e commit 97b7863

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/i3_non_indexed_fks.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ with fk_actions ( code, action ) as (
6363
join fk_cols_list using (fkoid)
6464
left join index_list on
6565
conrelid = indrelid
66-
and (indkey::int2[])[0:(array_length(key_cols,1) -1)] operator(pg_catalog.@>) key_cols
66+
and (indkey::int2[])[0:(array_length(key_cols,1) -1)] operator(pg_catalog.@>) key_cols::int2[]
6767

6868
), fk_perfect_match as (
6969
select fkoid

0 commit comments

Comments
 (0)