Re: BUG #18295: In PostgreSQL a unique index on targeted columns is sufficient to support a foreign key
От | David Rowley |
---|---|
Тема | Re: BUG #18295: In PostgreSQL a unique index on targeted columns is sufficient to support a foreign key |
Дата | |
Msg-id | CAApHDvoaMq1oGxJbfVK4Miwp=0DbhuTJhkUuYOw-Q=WkOmH-qQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #18295: In PostgreSQL a unique index on targeted columns is sufficient to support a foreign key (Laurenz Albe <laurenz.albe@cybertec.at>) |
Ответы |
Re: BUG #18295: In PostgreSQL a unique index on targeted columns is sufficient to support a foreign key
|
Список | pgsql-bugs |
On Fri, 26 Jan 2024 at 23:55, Laurenz Albe <laurenz.albe@cybertec.at> wrote: > Attached is my suggested patch. Why did you choose to remove the mention of primary key and unique constraints in: +++ b/doc/src/sgml/ddl.sgml @@ -1317,9 +1317,7 @@ CREATE TABLE posts ( </para> <para> - A foreign key must reference columns that either are a primary key or - form a unique constraint. This means that the referenced columns always - have an index (the one underlying the primary key or unique constraint); + A foreign key must reference columns on which a unique index in defined, but choose to keep them here: +++ b/doc/src/sgml/ref/create_table.sgml @@ -1166,7 +1166,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM class="parameter">refcolumn</replaceable> list is omitted, the primary key of the <replaceable class="parameter">reftable</replaceable> is used. The referenced columns must be the columns of a non-deferrable - unique or primary key constraint in the referenced table. The user + unique or primary key constraint or a unique index in the referenced table. The user I'd rather we continue to mention primary keys and unique constraints in ddl.sgml. It just seems good practice to me to define a constraint and it seems better if people continue to do that to increase the likelihood that their schema is compatible with another RDBMS. David
В списке pgsql-bugs по дате отправления: