Re: Can I habe multi table indices?

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Andreas *EXTERN*" <maps(dot)on(at)gmx(dot)net>, PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can I habe multi table indices?
Date: 2015-02-02 09:58:31
Message-ID: A737B7A37273E048B164557ADEF4A58B36595003@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andreas wrote:

> can I habe multi table indices to ensure that certain IDs can only
> appear in on relation?
>
> Like
>
> table_0(id int), table_1(id int), table_2(id int)
> rel_1_to_0( id_1 int, id_0 int )
> rel_2_to_0( id_2 int, id_0 int )
>
> An id of table_0 should only exist either in rel_1_to_0 OR rel_2_to_0.

You cannot have one index across several tables.

> How can I do this?

Perhaps with a trigger that checks if the condition is satisfied.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Evans 2015-02-02 11:06:37 Stability of JSON textual representation
Previous Message Tim Clarke 2015-02-02 09:56:54 Re: How do I bump a row to the front of sort efficiently