You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2017/11/15 16:50:27 UTC

[2/2] hive git commit: HIVE-18046: Metastore: default IS_REWRITE_ENABLED=false instead of NULL (Jesus Camacho Rodriguez, reviewed by Sergey Shelukhin)

HIVE-18046: Metastore: default IS_REWRITE_ENABLED=false instead of NULL (Jesus Camacho Rodriguez, reviewed by Sergey Shelukhin)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/e3168cfc
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/e3168cfc
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/e3168cfc

Branch: refs/heads/master
Commit: e3168cfc867a534d82e4fd6deef1ba4c4c5ed7c1
Parents: afa9ffe
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Mon Nov 13 10:38:34 2017 -0800
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Wed Nov 15 08:50:02 2017 -0800

----------------------------------------------------------------------
 metastore/scripts/upgrade/derby/037-HIVE-14496.derby.sql          | 1 +
 metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql       | 2 +-
 metastore/scripts/upgrade/derby/hive-schema-2.3.0.derby.sql       | 2 +-
 metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql       | 2 +-
 metastore/scripts/upgrade/mssql/022-HIVE-14496.mssql.sql          | 2 +-
 metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql       | 2 +-
 metastore/scripts/upgrade/mssql/hive-schema-2.3.0.mssql.sql       | 2 +-
 metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql       | 2 +-
 metastore/scripts/upgrade/mysql/037-HIVE-14496.mysql.sql          | 2 +-
 metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql       | 2 +-
 metastore/scripts/upgrade/mysql/hive-schema-2.3.0.mysql.sql       | 2 +-
 metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql       | 2 +-
 metastore/scripts/upgrade/oracle/037-HIVE-14496.oracle.sql        | 1 +
 metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql     | 2 +-
 metastore/scripts/upgrade/oracle/hive-schema-2.3.0.oracle.sql     | 2 +-
 metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql     | 2 +-
 metastore/scripts/upgrade/postgres/036-HIVE-14496.postgres.sql    | 1 +
 metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql | 2 +-
 metastore/scripts/upgrade/postgres/hive-schema-2.3.0.postgres.sql | 2 +-
 metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql | 2 +-
 20 files changed, 20 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/derby/037-HIVE-14496.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/037-HIVE-14496.derby.sql b/metastore/scripts/upgrade/derby/037-HIVE-14496.derby.sql
index 0c294ce..86c6673 100644
--- a/metastore/scripts/upgrade/derby/037-HIVE-14496.derby.sql
+++ b/metastore/scripts/upgrade/derby/037-HIVE-14496.derby.sql
@@ -5,4 +5,5 @@ ALTER TABLE "APP"."TBLS" ADD "IS_REWRITE_ENABLED" CHAR(1);
 UPDATE "APP"."TBLS" SET "IS_REWRITE_ENABLED" = 'N';
 
 -- Step 3: Alter the column to disallow null values
+ALTER TABLE "APP"."TBLS" ALTER COLUMN "IS_REWRITE_ENABLED" SET DEFAULT 'N';
 ALTER TABLE "APP"."TBLS" ALTER COLUMN "IS_REWRITE_ENABLED" NOT NULL;

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql b/metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql
index 6dd3dee..2e3aaf0 100644
--- a/metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql
+++ b/metastore/scripts/upgrade/derby/hive-schema-2.2.0.derby.sql
@@ -60,7 +60,7 @@ CREATE TABLE "APP"."COLUMNS" ("SD_ID" BIGINT NOT NULL, "COMMENT" VARCHAR(256), "
 
 CREATE TABLE "APP"."ROLES" ("ROLE_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "OWNER_NAME" VARCHAR(128), "ROLE_NAME" VARCHAR(128));
 
-CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL);
+CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL DEFAULT 'N');
 
 CREATE TABLE "APP"."PARTITION_KEYS" ("TBL_ID" BIGINT NOT NULL, "PKEY_COMMENT" VARCHAR(4000), "PKEY_NAME" VARCHAR(128) NOT NULL, "PKEY_TYPE" VARCHAR(767) NOT NULL, "INTEGER_IDX" INTEGER NOT NULL);
 

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/derby/hive-schema-2.3.0.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/hive-schema-2.3.0.derby.sql b/metastore/scripts/upgrade/derby/hive-schema-2.3.0.derby.sql
index b2916c8..3c4d9ee 100644
--- a/metastore/scripts/upgrade/derby/hive-schema-2.3.0.derby.sql
+++ b/metastore/scripts/upgrade/derby/hive-schema-2.3.0.derby.sql
@@ -60,7 +60,7 @@ CREATE TABLE "APP"."COLUMNS" ("SD_ID" BIGINT NOT NULL, "COMMENT" VARCHAR(256), "
 
 CREATE TABLE "APP"."ROLES" ("ROLE_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "OWNER_NAME" VARCHAR(128), "ROLE_NAME" VARCHAR(128));
 
-CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL);
+CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL DEFAULT 'N');
 
 CREATE TABLE "APP"."PARTITION_KEYS" ("TBL_ID" BIGINT NOT NULL, "PKEY_COMMENT" VARCHAR(4000), "PKEY_NAME" VARCHAR(128) NOT NULL, "PKEY_TYPE" VARCHAR(767) NOT NULL, "INTEGER_IDX" INTEGER NOT NULL);
 

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql b/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql
index 1d21fa2..16aae7a 100644
--- a/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql
+++ b/metastore/scripts/upgrade/derby/hive-schema-3.0.0.derby.sql
@@ -60,7 +60,7 @@ CREATE TABLE "APP"."COLUMNS" ("SD_ID" BIGINT NOT NULL, "COMMENT" VARCHAR(256), "
 
 CREATE TABLE "APP"."ROLES" ("ROLE_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "OWNER_NAME" VARCHAR(128), "ROLE_NAME" VARCHAR(128));
 
-CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL);
+CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL DEFAULT 'N');
 
 CREATE TABLE "APP"."PARTITION_KEYS" ("TBL_ID" BIGINT NOT NULL, "PKEY_COMMENT" VARCHAR(4000), "PKEY_NAME" VARCHAR(128) NOT NULL, "PKEY_TYPE" VARCHAR(767) NOT NULL, "INTEGER_IDX" INTEGER NOT NULL);
 

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/mssql/022-HIVE-14496.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/022-HIVE-14496.mssql.sql b/metastore/scripts/upgrade/mssql/022-HIVE-14496.mssql.sql
index 0c59467..c3ee236 100644
--- a/metastore/scripts/upgrade/mssql/022-HIVE-14496.mssql.sql
+++ b/metastore/scripts/upgrade/mssql/022-HIVE-14496.mssql.sql
@@ -1 +1 @@
-ALTER TABLE TBLS ADD IS_REWRITE_ENABLED bit NOT NULL DEFAULT 0;
+ALTER TABLE TBLS ADD IS_REWRITE_ENABLED bit NOT NULL DEFAULT(0);

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql b/metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql
index b6fdc7b..7cd49b3 100644
--- a/metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql
+++ b/metastore/scripts/upgrade/mssql/hive-schema-2.2.0.mssql.sql
@@ -359,7 +359,7 @@ CREATE TABLE TBLS
     TBL_TYPE nvarchar(128) NULL,
     VIEW_EXPANDED_TEXT text NULL,
     VIEW_ORIGINAL_TEXT text NULL,
-    IS_REWRITE_ENABLED bit NOT NULL
+    IS_REWRITE_ENABLED bit NOT NULL DEFAULT 0
 );
 
 ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID);

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/mssql/hive-schema-2.3.0.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/hive-schema-2.3.0.mssql.sql b/metastore/scripts/upgrade/mssql/hive-schema-2.3.0.mssql.sql
index c117a32..3df5369 100644
--- a/metastore/scripts/upgrade/mssql/hive-schema-2.3.0.mssql.sql
+++ b/metastore/scripts/upgrade/mssql/hive-schema-2.3.0.mssql.sql
@@ -359,7 +359,7 @@ CREATE TABLE TBLS
     TBL_TYPE nvarchar(128) NULL,
     VIEW_EXPANDED_TEXT text NULL,
     VIEW_ORIGINAL_TEXT text NULL,
-    IS_REWRITE_ENABLED bit NOT NULL
+    IS_REWRITE_ENABLED bit NOT NULL DEFAULT 0
 );
 
 ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID);

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql b/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql
index b189c31..70e1267 100644
--- a/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql
+++ b/metastore/scripts/upgrade/mssql/hive-schema-3.0.0.mssql.sql
@@ -361,7 +361,7 @@ CREATE TABLE TBLS
     TBL_TYPE nvarchar(128) NULL,
     VIEW_EXPANDED_TEXT text NULL,
     VIEW_ORIGINAL_TEXT text NULL,
-    IS_REWRITE_ENABLED bit NOT NULL
+    IS_REWRITE_ENABLED bit NOT NULL DEFAULT 0
 );
 
 ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID);

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/mysql/037-HIVE-14496.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/037-HIVE-14496.mysql.sql b/metastore/scripts/upgrade/mysql/037-HIVE-14496.mysql.sql
index 6cccefe..5a5a5e4 100644
--- a/metastore/scripts/upgrade/mysql/037-HIVE-14496.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/037-HIVE-14496.mysql.sql
@@ -5,4 +5,4 @@ ALTER TABLE `TBLS` ADD `IS_REWRITE_ENABLED` bit(1);
 UPDATE `TBLS` SET `IS_REWRITE_ENABLED` = false;
 
 -- Step 3: Alter the column to disallow null values
-ALTER TABLE `TBLS` MODIFY COLUMN `IS_REWRITE_ENABLED` bit(1) NOT NULL;
+ALTER TABLE `TBLS` MODIFY COLUMN `IS_REWRITE_ENABLED` bit(1) NOT NULL DEFAULT 0;

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql b/metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql
index d1852df..9b20b48 100644
--- a/metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/hive-schema-2.2.0.mysql.sql
@@ -587,7 +587,7 @@ CREATE TABLE IF NOT EXISTS `TBLS` (
   `TBL_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
   `VIEW_EXPANDED_TEXT` mediumtext,
   `VIEW_ORIGINAL_TEXT` mediumtext,
-  `IS_REWRITE_ENABLED` bit(1) NOT NULL,
+  `IS_REWRITE_ENABLED` bit(1) NOT NULL DEFAULT 0,
   PRIMARY KEY (`TBL_ID`),
   UNIQUE KEY `UNIQUETABLE` (`TBL_NAME`,`DB_ID`),
   KEY `TBLS_N50` (`SD_ID`),

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/mysql/hive-schema-2.3.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/hive-schema-2.3.0.mysql.sql b/metastore/scripts/upgrade/mysql/hive-schema-2.3.0.mysql.sql
index 1403e38..133edcb 100644
--- a/metastore/scripts/upgrade/mysql/hive-schema-2.3.0.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/hive-schema-2.3.0.mysql.sql
@@ -587,7 +587,7 @@ CREATE TABLE IF NOT EXISTS `TBLS` (
   `TBL_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
   `VIEW_EXPANDED_TEXT` mediumtext,
   `VIEW_ORIGINAL_TEXT` mediumtext,
-  `IS_REWRITE_ENABLED` bit(1) NOT NULL,
+  `IS_REWRITE_ENABLED` bit(1) NOT NULL DEFAULT 0,
   PRIMARY KEY (`TBL_ID`),
   UNIQUE KEY `UNIQUETABLE` (`TBL_NAME`,`DB_ID`),
   KEY `TBLS_N50` (`SD_ID`),

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql b/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql
index 702a929..9b66e83 100644
--- a/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql
+++ b/metastore/scripts/upgrade/mysql/hive-schema-3.0.0.mysql.sql
@@ -587,7 +587,7 @@ CREATE TABLE IF NOT EXISTS `TBLS` (
   `TBL_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
   `VIEW_EXPANDED_TEXT` mediumtext,
   `VIEW_ORIGINAL_TEXT` mediumtext,
-  `IS_REWRITE_ENABLED` bit(1) NOT NULL,
+  `IS_REWRITE_ENABLED` bit(1) NOT NULL DEFAULT 0,
   PRIMARY KEY (`TBL_ID`),
   UNIQUE KEY `UNIQUETABLE` (`TBL_NAME`,`DB_ID`),
   KEY `TBLS_N50` (`SD_ID`),

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/oracle/037-HIVE-14496.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/037-HIVE-14496.oracle.sql b/metastore/scripts/upgrade/oracle/037-HIVE-14496.oracle.sql
index 2b3bb77..73ee21d 100644
--- a/metastore/scripts/upgrade/oracle/037-HIVE-14496.oracle.sql
+++ b/metastore/scripts/upgrade/oracle/037-HIVE-14496.oracle.sql
@@ -5,5 +5,6 @@ ALTER TABLE TBLS ADD IS_REWRITE_ENABLED NUMBER(1) NULL;
 UPDATE TBLS SET IS_REWRITE_ENABLED = 0;
 
 -- Step 3: Alter the column to disallow null values
+ALTER TABLE TBLS MODIFY(IS_REWRITE_ENABLED DEFAULT 0);
 ALTER TABLE TBLS MODIFY(IS_REWRITE_ENABLED NOT NULL);
 ALTER TABLE TBLS ADD CONSTRAINT REWRITE_CHECK CHECK (IS_REWRITE_ENABLED IN (1,0));

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql b/metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql
index 4aaa5e7..3824ea9 100644
--- a/metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql
+++ b/metastore/scripts/upgrade/oracle/hive-schema-2.2.0.oracle.sql
@@ -376,7 +376,7 @@ CREATE TABLE TBLS
     TBL_TYPE VARCHAR2(128) NULL,
     VIEW_EXPANDED_TEXT CLOB NULL,
     VIEW_ORIGINAL_TEXT CLOB NULL,
-    IS_REWRITE_ENABLED NUMBER(1) NOT NULL CHECK (IS_REWRITE_ENABLED IN (1,0))
+    IS_REWRITE_ENABLED NUMBER(1) DEFAULT 0 NOT NULL CHECK (IS_REWRITE_ENABLED IN (1,0))
 );
 
 ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID);

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/oracle/hive-schema-2.3.0.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/hive-schema-2.3.0.oracle.sql b/metastore/scripts/upgrade/oracle/hive-schema-2.3.0.oracle.sql
index 259a2ad..3b2b512 100644
--- a/metastore/scripts/upgrade/oracle/hive-schema-2.3.0.oracle.sql
+++ b/metastore/scripts/upgrade/oracle/hive-schema-2.3.0.oracle.sql
@@ -376,7 +376,7 @@ CREATE TABLE TBLS
     TBL_TYPE VARCHAR2(128) NULL,
     VIEW_EXPANDED_TEXT CLOB NULL,
     VIEW_ORIGINAL_TEXT CLOB NULL,
-    IS_REWRITE_ENABLED NUMBER(1) NOT NULL CHECK (IS_REWRITE_ENABLED IN (1,0))
+    IS_REWRITE_ENABLED NUMBER(1) DEFAULT 0 NOT NULL CHECK (IS_REWRITE_ENABLED IN (1,0))
 );
 
 ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID);

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql b/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql
index 6e9c7ff..de55e70 100644
--- a/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql
+++ b/metastore/scripts/upgrade/oracle/hive-schema-3.0.0.oracle.sql
@@ -376,7 +376,7 @@ CREATE TABLE TBLS
     TBL_TYPE VARCHAR2(128) NULL,
     VIEW_EXPANDED_TEXT CLOB NULL,
     VIEW_ORIGINAL_TEXT CLOB NULL,
-    IS_REWRITE_ENABLED NUMBER(1) NOT NULL CHECK (IS_REWRITE_ENABLED IN (1,0))
+    IS_REWRITE_ENABLED NUMBER(1) DEFAULT 0 NOT NULL CHECK (IS_REWRITE_ENABLED IN (1,0))
 );
 
 ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID);

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/postgres/036-HIVE-14496.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/036-HIVE-14496.postgres.sql b/metastore/scripts/upgrade/postgres/036-HIVE-14496.postgres.sql
index 1910cc3..22dc855 100644
--- a/metastore/scripts/upgrade/postgres/036-HIVE-14496.postgres.sql
+++ b/metastore/scripts/upgrade/postgres/036-HIVE-14496.postgres.sql
@@ -6,3 +6,4 @@ UPDATE "TBLS" SET "IS_REWRITE_ENABLED" = false;
 
 -- Step 3: Alter the column to disallow null values
 ALTER TABLE "TBLS" ALTER COLUMN "IS_REWRITE_ENABLED" SET NOT NULL;
+ALTER TABLE "TBLS" ALTER COLUMN "IS_REWRITE_ENABLED" SET DEFAULT false;

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql b/metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql
index 5feab4e..63acce7 100644
--- a/metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql
+++ b/metastore/scripts/upgrade/postgres/hive-schema-2.2.0.postgres.sql
@@ -373,7 +373,7 @@ CREATE TABLE "TBLS" (
     "TBL_TYPE" character varying(128) DEFAULT NULL::character varying,
     "VIEW_EXPANDED_TEXT" text,
     "VIEW_ORIGINAL_TEXT" text,
-    "IS_REWRITE_ENABLED" boolean NOT NULL
+    "IS_REWRITE_ENABLED" boolean NOT NULL DEFAULT false
 );
 
 

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/postgres/hive-schema-2.3.0.postgres.sql
----------------------------------------------------------------------
diff --git a/metastore/scripts/upgrade/postgres/hive-schema-2.3.0.postgres.sql b/metastore/scripts/upgrade/postgres/hive-schema-2.3.0.postgres.sql
index a6d976f..a04883c 100644
--- a/metastore/scripts/upgrade/postgres/hive-schema-2.3.0.postgres.sql
+++ b/metastore/scripts/upgrade/postgres/hive-schema-2.3.0.postgres.sql
@@ -373,7 +373,7 @@ CREATE TABLE "TBLS" (
     "TBL_TYPE" character varying(128) DEFAULT NULL::character varying,
     "VIEW_EXPANDED_TEXT" text,
     "VIEW_ORIGINAL_TEXT" text,
-    "IS_REWRITE_ENABLED" boolean NOT NULL
+    "IS_REWRITE_ENABLED" boolean NOT NULL DEFAULT false
 );
 
 

http://git-wip-us.apache.org/repos/asf/hive/blob/e3168cfc/metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql
----------------------------------------------------------------------
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 7504604..23626c0 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
@@ -373,7 +373,7 @@ CREATE TABLE "TBLS" (
     "TBL_TYPE" character varying(128) DEFAULT NULL::character varying,
     "VIEW_EXPANDED_TEXT" text,
     "VIEW_ORIGINAL_TEXT" text,
-    "IS_REWRITE_ENABLED" boolean NOT NULL
+    "IS_REWRITE_ENABLED" boolean NOT NULL DEFAULT false
 );