Repository: sentry Updated Branches: refs/heads/master e94c5d6d0 -> e4791a029
SENTRY-2219: Create index AUTHZ_PATH_FK_IDX at table AUTHZ_PATH only when it does not exist for Oracle (Na Li, reviewed by Rajan Santhanam, Sergio Pena, Kalyan Kumar Kalvagadda, Arjun Mishra) Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/e4791a02 Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/e4791a02 Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/e4791a02 Branch: refs/heads/master Commit: e4791a029a27506afa4caf37552041216ad0a43b Parents: e94c5d6 Author: lina.li <[email protected]> Authored: Wed May 9 11:04:49 2018 -0500 Committer: lina.li <[email protected]> Committed: Wed May 9 11:04:49 2018 -0500 ---------------------------------------------------------------------- .../src/main/resources/010-SENTRY-2210.oracle.sql | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/e4791a02/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.oracle.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.oracle.sql b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.oracle.sql index 3fa60bb..f4ba8d5 100644 --- a/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.oracle.sql +++ b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.oracle.sql @@ -1,2 +1,15 @@ -- create index for foreign key AUTHZ_OBJ_ID -CREATE INDEX "AUTHZ_PATH_FK_IDX" ON "AUTHZ_PATH" ("AUTHZ_OBJ_ID"); \ No newline at end of file +set serveroutput on +declare + already_exists exception; + columns_indexed exception; + pragma exception_init( already_exists, -955 ); + pragma exception_init(columns_indexed, -1408); +begin + execute immediate 'CREATE INDEX "AUTHZ_PATH_FK_IDX" ON "AUTHZ_PATH" ("AUTHZ_OBJ_ID")'; + dbms_output.put_line( 'created' ); +exception + when already_exists or columns_indexed then + dbms_output.put_line( 'skipped' ); +end; +/ \ No newline at end of file
