Skip site navigation (1) Skip section navigation (2)

Re: effective SELECT from child tables

From: "Ilia Kantor" <ilia(at)obnovlenie(dot)ru>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: effective SELECT from child tables
Date: 2005-09-28 08:12:53
Message-ID: auto-000571637655@umail.ru (view raw or flat)
Thread:
Lists: pgsql-hackers
>> Maybe new constraint_exclusion staff could help to exclude non-matching
>> tables from inheritance query ?

> Yes, that's exactly what it's for.  Your testing is welcome.  Download 8.1

> and try it today.

Great, I'm developing on 8.1b2 now... 
But could you be more particular about the solution ?


Only the way I can think of is to add "relname" field into parent table, add
"BEFORE INSERT" trigger to each child that will set it appropriately and
CHECK (relname=<here goes table name>).
It works in this case..
More than that.. I can create indexes on each table with "WHERE
relname!=<table name>", then they are used with DELETE/UPDATE WHERE relname
IN(..). 

But the whole idea to adding an extra field, trigger and duplicating table
name multiple times.. Feels a bit stinky to me..

Could you suggest another path ?



In response to

Responses

pgsql-hackers by date

Next:From: Ilia KantorDate: 2005-09-28 08:13:43
Subject: Re: effective SELECT from child tables
Previous:From: Dave PageDate: 2005-09-28 07:33:10
Subject: Re: Open items list for 8.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group