Is it possible to define a constraint based on the values in other rows in the current table?

From: Glen Huang <heyhgl(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Is it possible to define a constraint based on the values in other rows in the current table?
Date: 2017-07-19 11:37:57
Message-ID: DB1C8829-F6ED-4BAF-A165-9A2CA5DCF932@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'd like to enforce that in a transaction, after a couple inserts & updates, a particular column has continuous values like 1, 2, 3, and never any gaps. Is it possible to do?

I gave a concrete example here: https://stackoverflow.com/questions/45187113 <https://stackoverflow.com/questions/45187113> didn't get any answers yet.

Am I looking at the wrong direction? Should such feature be implemented with constraints?

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message vinny 2017-07-19 12:02:14 Re: Is it possible to define a constraint based on the values in other rows in the current table?
Previous Message Tom Lane 2017-07-19 03:30:30 Re: hash join performance question