[teiid-issues] [JBoss JIRA] (TEIID-2557) Provide support for Composite Foreign Keys in MongoDB

Ramesh Reddy (JIRA) jira-events at lists.jboss.org
Thu Jun 20 12:42:20 EDT 2013


     [ https://issues.jboss.org/browse/TEIID-2557?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ramesh Reddy resolved TEIID-2557.
---------------------------------

           Labels: alpha1  (was: )
    Fix Version/s: 8.5
       Resolution: Done


Added support to handle the composite foreign key. 

The need itself may be little un-common, but when used on table all the referencing columns in FK, get all the columns involved in FK. For ex:

{code}
CREATE FOREIGN TABLE G1 (
    e1 integer NOT NULL,
    e2 integer NOT NULL,
    e3 integer,
    PRIMARY KEY (e1, e2)
) OPTIONS(UPDATABLE 'TRUE');

CREATE FOREIGN TABLE G2 (
    e1 integer NOT NULL,
    e2 integer NOT NULL,
    e3 integer,
    FOREIGN KEY (e1, e2) REFERENCES G1 (e1, e2)
) OPTIONS(UPDATABLE 'TRUE');
{code} 

will generate a document like

{code}
> db.G1.findOne()
{ 
        "_id" : { "e1" : 1, "e2" : 2 }, 
        "e3" : 3 
}
> db.G2.findOne()
{
	"_id" : DBRef("G1", { "e1" : 1, "e2" : 2 }),
	"e2" : DBRef("G1", { "e1" : 1, "e2" : 2 }),
	"e3" : 3
}
{code}

This way I could keep the DBRef structure intact, only side effect is during the updates one needs to supply all the keys to form a correct query, otherwise it will result in error.
                
> Provide support for Composite Foreign Keys in MongoDB
> -----------------------------------------------------
>
>                 Key: TEIID-2557
>                 URL: https://issues.jboss.org/browse/TEIID-2557
>             Project: Teiid
>          Issue Type: Bug
>          Components: Misc. Connectors
>    Affects Versions: 8.4
>            Reporter: Ramesh Reddy
>            Assignee: Ramesh Reddy
>              Labels: alpha1
>             Fix For: 8.4.1, 8.5
>
>
> TEIID-2529 provided support for PK, but missed the FKs that have multiple keys, this need to be fixed

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the teiid-issues mailing list