Search Postgresql Archives

Re: FK v.s unique indexes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday, July 3, 2018, Rafal Pietrak <rafal@xxxxxxxxx> wrote:

ERROR:  there is no unique constraint matching given keys for referenced
table "test2"
----------------------------

I cannot see any reasons why this functionality is blocked.

In particular, contrary to what the ERROR says, the target table *does
have* a "unique constraint matching given keys", admittedly only
partial.

You are making the common error of confusing the distinct concepts of constraints and indexs.  Table constraints cannot be partial by definition, and are a logical concept constraining the data model.  Indexes are physical objects that only aid in the execution of queries.  The only crossover is that the implementation of a unique table constraint uses a full unique index as an implementation detail.

The error says 'constraint' and indeed you have nit defined a relevant constraint in your schema, just indexes.

David J.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux