1

If I have a table with a column with an array of strings, how can I create a constraint to ensure that the arrays in all rows are disjoint sets (ie. no string is present in the array in more than one row)?

This would be for postgres, need a gin index, and using the && array operator.

kag0
  • 5,624
  • 7
  • 34
  • 67
  • In theory an exclusion constraint is the way to go. However, currently only GIST operators are supported for that, and there are no GIST operators for arrays. The best way is probably to properly normalize this. –  Oct 07 '22 at 21:41

0 Answers0