Re: UNIQUE constraint matching given keys for referenced

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: UNIQUE constraint matching given keys for referenced
Дата
Msg-id 578.1028902047@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: UNIQUE constraint matching given keys for referenced  (Jeff Eckermann <jeff_eckermann@yahoo.com>)
Список pgsql-general
Jeff Eckermann <jeff_eckermann@yahoo.com> writes:
> Seems kind of odd that PostgreSQL should care more
> about the non-existence of the unique constraint on a
> field than about the non-existence of that field
> itself.

Yeah, that's irritated me too.  It doesn't look quite trivial to fix
though, since you can't just check that the fields exist --- they may
not exist, yet.  Consider a self-referential table:

    create table tree_nodes (id int primary key,
                 parent int references tree_nodes(id),
                 ...);

There are double code paths in all of the analyze.c code for foreign
keys to handle both the already-exists and the will-create-it case.
Rearranging things to check column existence before existence of the
constraint thus looks a bit tricky.

But feel free to send in a patch ;-)

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: The standard 'why does it take so long' question
Следующее
От: Neil Conway
Дата:
Сообщение: Re: Stored procedures returning rowsets