]
Work on TEIID-5333 started by Steven Hawkins.
---------------------------------------------
Complex foreign keys set the referenced key regardless of order
---------------------------------------------------------------
Key: TEIID-5333
URL:
https://issues.jboss.org/browse/TEIID-5333
Project: Teiid
Issue Type: Bug
Components: Query Engine
Reporter: Steven Hawkins
Assignee: Steven Hawkins
The metadatavalidator will resolve foreign keys as long as the columns match - but does
not reorder the fk columns nor track the referenced order which means that the referenced
key can be wrong. For example:
{code}
CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 integer, PRIMARY KEY(g1e1, g1e2));
CREATE FOREIGN TABLE G2(g2e1 integer, g2e2 integer, FOREIGN KEY (g2e1, g2e2) REFERENCES
G1(g1e2, g1e1));
{code}
Note that the elements are reversed in the references list, but this is not captured in
the resolved foreign key meaning that it effectively represents a relationship on
g2e1,g2e2 with g1e1,g1e2.