Re: Proposal: Global Index - Mailing list pgsql-hackers

From Isaac Morland
Subject Re: Proposal: Global Index
Date
Msg-id CAMsGm5dySvX-cirmmnR5+t89Qa_GjvF2mVFzE9YBRZy-PMqg7g@mail.gmail.com
Whole thread Raw
In response to Proposal: Global Index  (Ibrar Ahmed <ibrar.ahmad@gmail.com>)
Responses Re: Proposal: Global Index
List pgsql-hackers
On Thu, 31 Oct 2019 at 14:50, Stephen Frost <sfrost@snowman.net> wrote:
Greetings,

* Peter Geoghegan (pg@bowt.ie) wrote:
[....] 

Absolutely- our lack of such is a common point of issue when folks are
considering using or migrating to PostgreSQL.

Not sure how similar my situation really is, but I find myself wanting to have indices that cross non-partition members of an inheritance hierarchy:

create table t (
    id int,
    primary key (id)
);

create table t1 (
    a text
) inherits (t);

create table t2 (
    b int,
    c int
) inherits (t);

So "t"s are identified by an integer; and one kind of "t" has a single text attribute while a different kind of "t" has 2 int attributes. The idea is that there is a single primary key constraint on the whole hierarchy that ensures only one record with a particular id can exist in all the tables together. I can imagine wanting to do this with other unique constraints also.

At present I don't actually use inheritance; instead I put triggers on the child tables that do an insert on the parent table, which has the effect of enforcing the uniqueness I want.

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Proposal: Global Index
Next
From: Tomas Vondra
Date:
Subject: Re: Removing alignment padding for byval types