Re: BUG #11554: Enforce that number and type of both columns involved in fkey are same type

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #11554: Enforce that number and type of both columns involved in fkey are same type
Дата
Msg-id 5676.1412290708@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #11554: Enforce that number and type of both columns involved in fkey are same type  (gary.weaver@protolabs.com)
Ответы Re: BUG #11554: Enforce that number and type of both columns involved in fkey are same type
Список pgsql-bugs
gary.weaver@protolabs.com writes:
> To help adhere to the statement, "Of course, the number and type of the
> constrained columns need to match the number and type of the referenced
> columns." as noted in
> http://www.postgresql.org/docs/9.3/static/ddl-constraints.html shouldn't PG
> enforce that both columns involved in a foreign key constraint are of the
> same number and type (e.g. int != bigint) at time of constraint creation?

No.  SQL92 did say that, but in SQL99 and later, the requirement is only
that the column types be comparable.  Which is what PG enforces.

> The problem is that if you are forced to use a tool that syncs data between
> databases of different types, other databases sometimes enforce that the
> types cannot be different. While this is not a frequent use case, it just
> makes sense in most cases that you'd want the two column types/sizes to be
> the same.

It would be more productive to lobby those other systems to become more
standards-compliant than to ask us to become less so.

In any case, this hardly seems like it would be the dominant problem
if you're trying to make schemas be exactly the same across multiple
products :-(.

            regards, tom lane

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

Предыдущее
От: David G Johnston
Дата:
Сообщение: Re: BUG #11477: psql -L no stderr
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: BUG #11550: Error messages contain not encodable characters (Latin9)