mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed a schema diff issue in which user mappings were not compared correctly. Fixes #6956
This commit is contained in:
@@ -25,6 +25,7 @@ from pgadmin.utils.driver import get_driver
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
|
||||
from pgadmin.tools.schema_diff.compare import SchemaDiffObjectCompare
|
||||
from pgadmin.utils.constants import PGADMIN_STRING_SEPARATOR
|
||||
|
||||
|
||||
class UserMappingModule(CollectionNodeModule):
|
||||
@@ -916,7 +917,14 @@ class UserMappingView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# the empty list.
|
||||
if 'umoptions' in data and data['umoptions'] is None:
|
||||
data['umoptions'] = []
|
||||
res[row['name']] = data
|
||||
|
||||
mapping_name = row['name']
|
||||
if 'srvname' in data:
|
||||
mapping_name = \
|
||||
row['name'] + PGADMIN_STRING_SEPARATOR + \
|
||||
data['srvname']
|
||||
|
||||
res[mapping_name] = data
|
||||
|
||||
return res
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ FROM pg_catalog.pg_foreign_server srv
|
||||
LEFT OUTER JOIN pg_catalog.pg_description des ON (des.objoid=srv.oid AND des.objsubid=0 AND des.classoid='pg_foreign_server'::regclass)
|
||||
WHERE srv.oid = {{fserid}}::oid
|
||||
{% elif fsid or umid %}
|
||||
SELECT u.umid AS oid, u.usename AS name, u.srvid AS fsid, umoptions AS umoptions, fs.srvfdw AS fdwid
|
||||
SELECT u.umid AS oid, u.usename AS name, fs.srvname, u.srvid AS fsid, umoptions AS umoptions, fs.srvfdw AS fdwid
|
||||
FROM pg_catalog.pg_user_mappings u
|
||||
LEFT JOIN pg_catalog.pg_foreign_server fs ON fs.oid = u.srvid
|
||||
{% if fsid %} WHERE u.srvid = {{fsid}}::oid {% endif %} {% if umid %} WHERE u.umid= {{umid}}::oid {% endif %}
|
||||
|
||||
Reference in New Issue
Block a user