sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amis...@apache.org
Subject sentry git commit: SENTRY-2333: Create index AUTHZ_PATH_FK_IDX at table AUTHZ_PATH for Postgres only when it does not exist (Arjun Mishra reviewed by Na Li)
Date Sat, 11 Aug 2018 02:56:00 GMT
Repository: sentry
Updated Branches:
  refs/heads/master 8446e8f17 -> 3d062f39c


SENTRY-2333: Create index AUTHZ_PATH_FK_IDX at table AUTHZ_PATH for Postgres only when it
does not exist (Arjun Mishra reviewed by Na Li)

Change-Id: I69caafa59d902d3231576f177d38a513c09a39f5


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

Branch: refs/heads/master
Commit: 3d062f39ce6a047138660a7b3d0024bde916c5b4
Parents: 8446e8f
Author: amishra <amishra@cloudera.com>
Authored: Fri Aug 10 21:54:45 2018 -0500
Committer: amishra <amishra@cloudera.com>
Committed: Fri Aug 10 21:55:00 2018 -0500

----------------------------------------------------------------------
 .../src/main/resources/010-SENTRY-2210.postgres.sql      | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/3d062f39/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.postgres.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.postgres.sql
b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.postgres.sql
index cdc2ff7..bb77561 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.postgres.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.postgres.sql
@@ -1,2 +1,11 @@
 -- create index for foreign key AUTHZ_OBJ_ID
-CREATE INDEX "AUTHZ_PATH_FK_IDX" ON "AUTHZ_PATH" USING btree ("AUTHZ_OBJ_ID");
\ No newline at end of file
+DO $BLOCK$
+BEGIN
+    BEGIN
+        CREATE INDEX "AUTHZ_PATH_FK_IDX" ON "AUTHZ_PATH"( "AUTHZ_OBJ_ID" );
+    EXCEPTION
+        WHEN duplicate_table
+        THEN RAISE NOTICE 'index ''AUTHZ_PATH_FK_IDX '' on ''AUTHZ_PATH'' already exists,
skipping';
+    END;
+END;
+$BLOCK$;
\ No newline at end of file


Mime
View raw message