Re: [pgadmin4][patch] GreenPlum error while checking roles SQL

2018-08-17 Thread Akshay Joshi
Thanks patch applied.

On Thu, Aug 16, 2018 at 9:12 PM, Joao De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hi Hackers,
>
> Attached you can find a patch that will correct issue #3578
>
> The SQL command used to retrieve the SQL for the Role does not work,
> because it as a piece of it that is intended for Postgres > 9.0.
>
> Thanks
> Joao
>



-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


[pgadmin4][patch] GreenPlum error while checking roles SQL

2018-08-16 Thread Joao De Almeida Pereira
Hi Hackers,

Attached you can find a patch that will correct issue #3578

The SQL command used to retrieve the SQL for the Role does not work,
because it as a piece of it that is intended for Postgres > 9.0.

Thanks
Joao
diff --git a/web/pgadmin/browser/server_groups/servers/roles/templates/role/sql/post8_4/sql.sql b/web/pgadmin/browser/server_groups/servers/roles/templates/role/sql/post8_4/sql.sql
index 642009e0..d3cb081b 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/templates/role/sql/post8_4/sql.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/templates/role/sql/post8_4/sql.sql
@@ -59,35 +59,6 @@ FROM
 		oid=%(rid)s::OID
 	) r
 ) a) b)
--- PostgreSQL >= 9.0
-UNION ALL
-(SELECT
-	array_to_string(array_agg(sql), E'\n') AS sql
-FROM
-	(SELECT
-		'ALTER ROLE ' || pg_catalog.quote_ident(pg_get_userbyid(%(rid)s::OID)) ||
-		' SET ' || param|| ' TO ' ||
-		CASE
-		WHEN param IN ('search_path', 'temp_tablespaces') THEN value
-		ELSE quote_literal(value)
-		END || ';' AS sql
-	FROM
-		(SELECT
-			datname, split_part(rolconfig, '=', 1) AS param, replace(rolconfig, split_part(rolconfig, '=', 1) || '=', '') AS value
-		FROM
-			(SELECT
-d.datname, unnest(c.setconfig) AS rolconfig
-			FROM
-(SELECT *
-FROM
-	pg_catalog.pg_db_role_setting dr
-WHERE
-	dr.setrole=%(rid)s::OID AND dr.setdatabase!=0) c
-LEFT JOIN pg_catalog.pg_database d ON (d.oid = c.setdatabase)
-			) a
-		) b
-	) d
-)
 UNION ALL
 (SELECT
 	'COMMENT ON ROLE ' || pg_catalog.quote_ident(pg_get_userbyid(%(rid)s::OID)) || ' IS ' ||  pg_catalog.quote_literal(description) || ';' AS sql