From b11fca909e7e9ddfd37e3949ecb6540aa713de21 Mon Sep 17 00:00:00 2001 From: Deepesh Khandelwal Date: Mon, 4 Dec 2017 19:09:48 -0800 Subject: [PATCH] HIVE-18220: Workload Management tables have broken constraints defined on postgres schema --- .../scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql b/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql index 065974fda6..415b5e0189 100644 --- a/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql +++ b/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql @@ -1010,7 +1010,7 @@ ALTER TABLE ONLY "METASTORE_DB_PROPERTIES" ALTER TABLE ONLY "WM_RESOURCEPLAN" ADD CONSTRAINT "WM_RESOURCEPLAN_pkey" PRIMARY KEY ("RP_ID"); -ALTER TABLE ONLY "WM_POOL" +ALTER TABLE ONLY "WM_RESOURCEPLAN" ADD CONSTRAINT "UNIQUE_WM_RESOURCEPLAN" UNIQUE ("NAME"); ALTER TABLE ONLY "WM_POOL" @@ -1544,14 +1544,11 @@ ALTER TABLE ONLY "FUNC_RU" -- Resource plan FK constraints. -ALTER TABLE ONLY "WM_RESOURCEPLAN" - ADD CONSTRAINT "WM_RESOURCEPLAN_FK1" FOREIGN KEY ("DEFAULT_POOL_ID") REFERENCES "WM_POOL" ("POOL_ID") DEFERRABLE; - ALTER TABLE ONLY "WM_POOL" ADD CONSTRAINT "WM_POOL_FK1" FOREIGN KEY ("RP_ID") REFERENCES "WM_RESOURCEPLAN" ("RP_ID") DEFERRABLE; -ALTER TABLE ONLY "WM_POOL" - ADD CONSTRAINT "WM_POOL_FK2" FOREIGN KEY ("PARENT_POOL_ID") REFERENCES "WM_POOL" ("POOL_ID") DEFERRABLE; +ALTER TABLE ONLY "WM_RESOURCEPLAN" + ADD CONSTRAINT "WM_RESOURCEPLAN_FK1" FOREIGN KEY ("DEFAULT_POOL_ID") REFERENCES "WM_POOL" ("POOL_ID") DEFERRABLE; ALTER TABLE ONLY "WM_TRIGGER" ADD CONSTRAINT "WM_TRIGGER_FK1" FOREIGN KEY ("RP_ID") REFERENCES "WM_RESOURCEPLAN" ("RP_ID") DEFERRABLE; -- 2.13.6 (Apple Git-96)