MJoin not work with composit primary Key

MJoin not work with composit primary Key

Ali AdnanAli Adnan Posts: 47Questions: 18Answers: 1

Dear Allan,

I am getting below error which I understand

"MJoin is not currently supported with a compound primary key for the main table."

but what is the work around or when it will be available as I am working in existing Database Project which has tables with composit primary keys and I need MJoin in order to store Data in Link Table.

Best Regards

Answers

  • allanallan Posts: 61,762Questions: 1Answers: 10,111 Site admin

    The only workaround at the moment is to create a custom VIEW in your SQL which will get the information without needing to use a compound primary key. There is no other workaround I'm afraid.

    Allan

  • Ali AdnanAli Adnan Posts: 47Questions: 18Answers: 1

    Dear Allan,
    Thanks for your reply, can you please explain me little bit more how can I insert Data in view ? if I create a view based on same table.

    I am using Oracle 11g R2 as a database, are you sure we can insert in view ?

  • allanallan Posts: 61,762Questions: 1Answers: 10,111 Site admin

    You can't I'm afraid - at least not as far as I am aware in Oracle. I think MySQL supports it, but not Oracle. A view is only useful for readonly data in Oracle.

    Are you writing to a link table, or are you just attempting to display information from the Mjoin?

    Allan

  • Ali AdnanAli Adnan Posts: 47Questions: 18Answers: 1

    Consider same example using below tables in your example

    USERS
    USER_PERMISSION
    PERMISSION

    if USERS table having composit key let say
    FIRST_NAME and LAST_NAME
    so how would it insert in link Table (USER_PERMISSION)

  • allanallan Posts: 61,762Questions: 1Answers: 10,111 Site admin

    If we use those tables, the user_permission table would need to have a third column added to it - the second column from the compound key - otherwise there would be no way to correctly address the rows.

    However, I'm afraid that, as I say, this isn't something that is currently supported by the Editor PHP and .NET libraries. They currently only support a single column in the link table for the joined tables. Unfortunately adding support for compound keys here is not going to be trivial. Possible, and something I hope to add in future, but it isn't on the immediate roadmap I'm afraid.

    Allan

This discussion has been closed.