You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Krisztian Kasa (Jira)" <ji...@apache.org> on 2023/11/07 12:27:00 UTC

[jira] [Comment Edited] (HIVE-27533) Incorrect FOREIGN KEY constraints in SHOW CREATE TABLE

    [ https://issues.apache.org/jira/browse/HIVE-27533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17783601#comment-17783601 ] 

Krisztian Kasa edited comment on HIVE-27533 at 11/7/23 12:26 PM:
-----------------------------------------------------------------

[~soumyakanti.das] 
Could you please add all repro steps to the description: create table statement and the show create table statement etc.
 


was (Author: kkasa):
[~soumyakanti.das] 
Could you please add the full repro steps to the description: create table statement and the show create table statement.
 

> Incorrect FOREIGN KEY constraints in SHOW CREATE TABLE
> ------------------------------------------------------
>
>                 Key: HIVE-27533
>                 URL: https://issues.apache.org/jira/browse/HIVE-27533
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>            Reporter: Soumyakanti Das
>            Assignee: Soumyakanti Das
>            Priority: Major
>              Labels: pull-request-available
>
> For a table that has a composite foreign key, SHOW CREATE TABLE returns multiple  ALTER STATEMENTS, which is incorrect.
> For example, for tpcds table {{{}catalog_returns{}}}, we see:
> {code:java}
> | ALTER TABLE tpcds_orc_def.catalog_returns ADD CONSTRAINT 3abe2c00-25ec-47ca-a5f9-38773995e8c1 FOREIGN KEY (cr_item_sk) REFERENCES tpcds_orc_def.catalog_sales(cs_item_sk) DISABLE NOVALIDATE RELY; |
> | ALTER TABLE tpcds_orc_def.catalog_returns ADD CONSTRAINT 3abe2c00-25ec-47ca-a5f9-38773995e8c1 FOREIGN KEY (cr_order_number) REFERENCES tpcds_orc_def.catalog_sales(cs_order_number) DISABLE NOVALIDATE RELY; | {code}
> Here we see two ALTER STATEMENTS with the same name, which reference primary keys of table {{{}catalog_sales{}}}. However, this is incorrect as a FK constraint cannot be on a subset of a composite PK.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)