Ensure sql for Role should be visible in SQL panel for GPDB. Fixes #3578

This commit is contained in:
Joao De Almeida Pereira 2018-08-17 14:50:16 +05:30 committed by Akshay Joshi
parent d68c967423
commit 46d4bf027d
2 changed files with 1 additions and 29 deletions

View File

@ -18,3 +18,4 @@ Bug fixes
| `Bug #3407 <https://redmine.postgresql.org/issues/3407>`_ - Fix keyboard shortcuts layout in the preferences panel.
| `Bug #3461 <https://redmine.postgresql.org/issues/3461>`_ - Ensure that refreshing a node also updates the Property list.
| `Bug #3528 <https://redmine.postgresql.org/issues/3528>`_ - Handle connection errors properly in the query tool.
| `Bug #3578 <https://redmine.postgresql.org/issues/3578>`_ - Ensure sql for Role should be visible in SQL panel for GPDB.

View File

@ -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