You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by me...@apache.org on 2020/01/10 07:18:09 UTC

[ranger] branch master updated: RANGER-2691: Fix MsSQL syntax in patch

This is an automated email from the ASF dual-hosted git repository.

mehul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new eb5aac4  RANGER-2691: Fix MsSQL syntax in patch
eb5aac4 is described below

commit eb5aac4babb95a9c06a27d6f6b089aa474eaa2b0
Author: Laszlo Denes Terjeki <lt...@cloudera.com>
AuthorDate: Thu Jan 9 19:27:39 2020 +0100

    RANGER-2691: Fix MsSQL syntax in patch
    
    Signed-off-by: Mehul Parikh <me...@apache.org>
---
 .../patches/035-update-schema-for-x-policy.sql     | 29 +++++++++++-----------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/security-admin/db/sqlserver/patches/035-update-schema-for-x-policy.sql b/security-admin/db/sqlserver/patches/035-update-schema-for-x-policy.sql
index 5b3ea05..1afb2ae 100644
--- a/security-admin/db/sqlserver/patches/035-update-schema-for-x-policy.sql
+++ b/security-admin/db/sqlserver/patches/035-update-schema-for-x-policy.sql
@@ -447,25 +447,24 @@ BEGIN
 	IF EXISTS(select name from x_service_def where name like 'atlas.%')
 	BEGIN
 		DECLARE @new_atlas_def_name VARCHAR(100);
-		set @new_atlas_def_name=(select name into new_atlas_def_name from x_service_def where name like 'atlas.%')
+		set @new_atlas_def_name=(select name from x_service_def where name like 'atlas.%')
 		IF EXISTS(select * from x_access_type_def where def_id in(select id from x_service_def where name='tag') and name in('atlas:read','atlas:create','atlas:update','atlas:delete','atlas:all'))
 		BEGIN
-			update x_access_type_def set name=concat(new_atlas_def_name , ':read') where def_id=100 and name='atlas:read';
-			update x_access_type_def set name=concat(new_atlas_def_name , ':create') where def_id=100 and name='atlas:create';
-			update x_access_type_def set name=concat(new_atlas_def_name , ':update') where def_id=100 and name='atlas:update';
-			update x_access_type_def set name=concat(new_atlas_def_name , ':delete') where def_id=100 and name='atlas:delete';
-			update x_access_type_def set name=concat(new_atlas_def_name , ':all') where def_id=100 and name='atlas:all';
-		END IF;
+			update x_access_type_def set name=concat(@new_atlas_def_name , ':read') where def_id=100 and name='atlas:read';
+			update x_access_type_def set name=concat(@new_atlas_def_name , ':create') where def_id=100 and name='atlas:create';
+			update x_access_type_def set name=concat(@new_atlas_def_name , ':update') where def_id=100 and name='atlas:update';
+			update x_access_type_def set name=concat(@new_atlas_def_name , ':delete') where def_id=100 and name='atlas:delete';
+			update x_access_type_def set name=concat(@new_atlas_def_name , ':all') where def_id=100 and name='atlas:all';
+		END
 		IF EXISTS(select * from x_access_type_def_grants where atd_id in (select id from x_access_type_def where def_id in (select id from x_service_def where name='tag') and name like 'atlas%') and implied_grant in ('atlas:read','atlas:create','atlas:update','atlas:delete','atlas:all'))
 		BEGIN
-			update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':read') where implied_grant='atlas:read';
-			update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':create') where implied_grant='atlas:create';
-			update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':update') where implied_grant='atlas:update';
-			update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':delete') where implied_grant='atlas:delete';
-			update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':all') where implied_grant='atlas:all';
-		END IF;
-	END IF;
-END IF;
+			update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':read') where implied_grant='atlas:read';
+			update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':create') where implied_grant='atlas:create';
+			update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':update') where implied_grant='atlas:update';
+			update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':delete') where implied_grant='atlas:delete';
+			update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':all') where implied_grant='atlas:all';
+		END
+	END
 END
 GO
 EXIT
\ No newline at end of file