Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/762#discussion_r83433726
  
    --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp ---
    @@ -4982,40 +4982,39 @@ odbc_SQLSvc_GetSQLCatalogs_sme_(
                         "cast(PKCO.CATALOG_NAME as varchar(128)) PKTABLE_CAT, "
                         "cast(PKCO.SCHEMA_NAME as varchar(128)) PKTABLE_SCHEM, 
"
                         "cast(PKCO.TABLE_NAME as varchar(128)) PKTABLE_NAME, "
    -                    "cast(PKCO.COLUMN_NAME as varchar(128)) 
PKCOLUMNS_NAME, "
    +                    "cast(PKCO.COLUMN_NAME as varchar(128)) PKCOLUMN_NAME, 
"
                         "cast(FKCO.CATALOG_NAME as varchar(128)) FKTABLE_CAT, "
                         "cast(PKCO.SCHEMA_NAME as varchar(128)) FKTABLE_SCHEM, 
"
                         "cast(FKCO.TABLE_NAME as varchar(128)) FKTABLE_NAME, "
                         "cast(FKCO.COLUMN_NAME as varchar(128)) FKCOLUMN_NAME, 
"
                         "cast(FKKV.ORDINAL_POSITION as smallint) KEY_SEQ, "
                         "cast(0 as smallint) update_rule, " // not support
                         "cast(0 as smallint) delete_rule, " // not support
    -                    "cast(PKCO.COLUMN_NAME as varchar(128)) fk_name, "
    -                    "cast(PKCO.COLUMN_NAME as varchar(128)) PK_NAME, "
    -                    "cast(0 as smallint) DEFERRABILITY "
    +                    "cast(FKKV.CONSTRAINT_NAME as varchar(128)) FK_NAME, "
    +                    "cast(PKKV.CONSTRAINT_NAME as varchar(128)) PK_NAME, "
    +                    "cast(0 as smallint) DEFERRABILITY " // not support
                         "from "
                         "TRAFODION.\"_MD_\".REF_CONSTRAINTS_VIEW rcv, "
                         "TRAFODION.\"_MD_\".KEYS_VIEW PKKV, "
                         "TRAFODION.\"_MD_\".KEYS_VIEW FKKV, "
                         "TRAFODION.\"_MD_\".COLUMNS_VIEW PKCO, "
                         "TRAFODION.\"_MD_\".COLUMNS_VIEW FKCO "
                         "where "
    -                    "PKKV.CONSTRAINT_NAME = rcv.CONSTRAINT_NAME "
    -                    "and FKKV.CONSTRAINT_NAME = rcv.UNIQUE_CONSTRAINT_NAME 
"
    +                    "FKKV.CONSTRAINT_NAME = rcv.CONSTRAINT_NAME "
    +                    "and PKKV.CONSTRAINT_NAME = rcv.UNIQUE_CONSTRAINT_NAME 
"
                         "and PKCO.TABLE_NAME = PKKV.TABLE_NAME "
                         "and FKCO.TABLE_NAME = FKKV.TABLE_NAME "
                         "and PKCO.COLUMN_NAME = PKKV.COLUMN_NAME "
                         "and FKCO.COLUMN_NAME = FKKV.COLUMN_NAME "
    -                    "and (rcv.TABLE_NAME = '%s' or trim(rcv.TABLE_NAME) 
LIKE '%s' ESCAPE '\\') "
                         "and (PKCO.SCHEMA_NAME = '%s' or 
trim(PKCO.SCHEMA_NAME) LIKE '%s' ESCAPE '\\') "
                         "and (PKCO.TABLE_NAME = '%s' or trim(PKCO.TABLE_NAME) 
LIKE '%s' ESCAPE '\\') "
                         "and (FKCO.SCHEMA_NAME = '%s' or 
trim(FKCO.SCHEMA_NAME) LIKE '%s' ESCAPE '\\') "
    -                    "and (FKCO.TABLE_NAME = '%s' or trim(FKCO.TABLE_NAME) 
LIKE '%s' ESCAPE '\\');",
    --- End diff --
    
    Is there a need to add  a condition on CONSTRAINT_TYPE in the where clause? 
You can try to enhance your test script to create the foreign key table with a 
primary key and check the output. BTW, thanks for adding the test script


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to