Re: REFERENCES constraint

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: REFERENCES constraint
Дата
Msg-id web-98845@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на REFERENCES constraint  (Cedar Cox <cedarc@visionforisrael.com>)
Ответы Re: REFERENCES constraint
Список pgsql-sql
Cedar,

> 1. Can a column reference more than one table?  (This assumes you use
> a
> single sequence to generate the IDs for both "tbla" and "tblb".  I
> guess
> you would also have the problem of enforcing a unique index.  Say
> what?!  
> A unique index across multiple tables.. absurd :)  eg..
> 
>   CREATE TABLE blah (
>     id int4,
>     f_id int4 REFERENCES tbla (id) REFERENCES tblb (id)
>   )

I'd reccomend, instead, having blah reference tbla and tbla reference
tblb.  It'd have the same effect, without forcing you to monkey around
with custom triggers.

> 2. Can a column reference another column in the same table?  eg..
> 
>   CREATE TABLE bloo (
>     id int4,
>     p_id int4 REFERENCES bloo (id)
>   -- or
>   --p_id int4 REFERENCES (id)
>   )

Er ... why would you want to?

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


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

Предыдущее
От: Jeff Eckermann
Дата:
Сообщение: RE: RE: Referencing named attribute in where clause doesn't work with7.1.2?
Следующее
От: "Alex Page"
Дата:
Сообщение: Problem with aggregate functions and GROUP BY