Обсуждение: Inheritance fixing timeline? (Was "Inherited FK Indexing")

Поиск
Список
Период
Сортировка

Inheritance fixing timeline? (Was "Inherited FK Indexing")

От
"Webb Sprague"
Дата:
> >   Is it
> > possible to have  FK that spans into child tables?
>
> This is a well known (and documented, see [1]) deficiency. It's due to
> the current implementation of indices, which are bound to exactly one
> table, meaning they do return a position within the table, but cannot
> point to different tables.

Is this set to be fixed in any particular release?

(Here's hoping that someone smarter than I am is working on it...)

-W

Re: Inheritance fixing timeline? (Was "Inherited FK Indexing")

От
Scott Ribe
Дата:
> Is this set to be fixed in any particular release?

Depending on what you're doing, this may be overkill, but: I have child
tables that not only need FK constraints, but also triggers and the
functions called by the triggers. So instead of writing this over and over
again, I eventually wrote a single procedure that takes the name of the
table, and using dynamic sql (execute command), generates the FKs and the
procedures and the triggers.

You *could* take it a step further, and have a procedure which takes the
name of the base table, finds all inherited tables, and makes sure
everything is set up correctly. I haven't, and probably won't, because I'm a
solo developer and don't make additions to the schema at such a great rate
that I would have trouble remembering to run my current "FooChild_Setup"
function on a new table.

--
Scott Ribe
scott_ribe@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice



Re: Inheritance fixing timeline? (Was "Inherited FK Indexing")

От
Alvaro Herrera
Дата:
Webb Sprague escribió:
> > >   Is it
> > > possible to have  FK that spans into child tables?
> >
> > This is a well known (and documented, see [1]) deficiency. It's due to
> > the current implementation of indices, which are bound to exactly one
> > table, meaning they do return a position within the table, but cannot
> > point to different tables.
>
> Is this set to be fixed in any particular release?

No, sorry.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support