Very interesting. But is the sort overhead worth it? Why not make the constraint deferrable before the update and switch back afterwards?
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных