You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Soumyakanti Das (Jira)" <ji...@apache.org> on 2023/07/27 06:04:00 UTC
[jira] [Created] (HIVE-27533) Incorrect FOREIGN KEY constraints in SHOW CREATE TABLE
Soumyakanti Das created HIVE-27533:
--------------------------------------
Summary: 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
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)