]
Steven Hawkins resolved TEIID-5333.
-----------------------------------
Fix Version/s: 10.3
10.1.4
10.2.2
Resolution: Done
This is not a common situation, so for now the handling in the metadata validator is to
just reorder the fk columns to match the pk columns. We can also just turn this into an
exception case with little effort, or if we need to have our logic account for the actual
order then we'll need to update a lot of assumptions.
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
Fix For: 10.3, 10.1.4, 10.2.2
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.