Re: Enforcing Join condition

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: Enforcing Join condition
Дата
Msg-id 20071115144721.GD1955@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на Re: Enforcing Join condition  ("சிவகுமார் மா"<masivakumar@gmail.com>)
Ответы Re: Enforcing Join condition
Список pgsql-general
On Thu, Nov 15, 2007 at 07:46:46PM +0530, ??????????????????????????? ?????? wrote:
> On Nov 15, 2007 5:52 PM, Sam Mason <sam@samason.me.uk> wrote:
> > What I tend to do here, is something like:
> >
> >   CREATE TABLE test (
> >     type  INTEGER,
> >     ref1 INTEGER REFERENCES table1 CHECK ((type = 1) = (ref1 IS NOT NULL)),
> >     ref2 INTEGER REFERENCES table2 CHECK ((type = 2) = (ref2 IS NOT NULL)),
> >     ref3 INTEGER REFERENCES table3 CHECK ((type = 3) = (ref3 IS NOT NULL))
> >   );
>
> Thanks for sharing. Will try it. But, we have more than 10 types in
> one table. Will be tough to handle.

As Albe suggested, a view is about all that's going to help the poor
people who work with this.  When I do this sort of thing, I tend to
find that there are very few queries that actually need everything all
together in one place.  It's generally that (using the naming above)
that you'd do a query on "table1", "test" and something that references
"test".  Queries that reference "test", "table1" and "table2" are
reasonably rare.  Of course, it could be that I was just lucky here.


  Sam

В списке pgsql-general по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: Chunk Delete
Следующее
От: Sam Mason
Дата:
Сообщение: Re: Chunk Delete