Re: How to implement a uniqueness constraint across multiple tables?

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to implement a uniqueness constraint across multiple tables?
Date: 2014-07-31 19:24:14
Message-ID: 53DA97DE.50104@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/31/2014 01:16 PM, Marti Raudsepp wrote:
> On Thu, Jul 31, 2014 at 9:38 PM, Kynn Jones <kynnjo(at)gmail(dot)com> wrote:
>> Does PostgreSQL have a good way to enforce the uniqueness of super_id values
>> across multiple tables?
> Well that's easy: no.
>
> Regards,
> Marti
>
>
That might be a little hasty. There are conditional definitions clauses
in indices. One could apply a check such that all subs don't have the
id or on each sub such that the others don't have the id. But can be
made unnecessary if inserts to all subs work off same id generator.

rjs

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Larry White 2014-07-31 19:47:07 Is it possible to create an index without keeping the indexed data in a column?
Previous Message Rob Sargent 2014-07-31 19:19:49 Re: How to implement a uniqueness constraint across multiple tables?