Fixed an issue where --load-server does not allow loading connections that use pg_services. Fixes #5746

This commit is contained in:
Rahul Shirsat 2020-08-31 17:49:46 +05:30 committed by Akshay Joshi
parent 5a253f9053
commit b5c299c5ad
2 changed files with 24 additions and 16 deletions

View File

@ -26,6 +26,7 @@ Bug fixes
| `Issue #5426 <https://redmine.postgresql.org/issues/5426>`_ - Adjusted the height of jobstep code block to use maximum space.
| `Issue #5652 <https://redmine.postgresql.org/issues/5652>`_ - Modified the 'Commit' and 'Rollback' query tool button icons.
| `Issue #5722 <https://redmine.postgresql.org/issues/5722>`_ - Ensure that the user should be able to drop the database even if it is connected.
| `Issue #5746 <https://redmine.postgresql.org/issues/5746>`_ - Fixed an issue where --load-server does not allow loading connections that use pg_services.
| `Issue #5748 <https://redmine.postgresql.org/issues/5748>`_ - Fixed incorrect reverse engineering SQL for Foreign key when creating a table.
| `Issue #5751 <https://redmine.postgresql.org/issues/5751>`_ - Enable the 'Configure' and 'View log' menu option when the server taking longer than usual time to start.
| `Issue #5754 <https://redmine.postgresql.org/issues/5754>`_ - Fixed an issue where schema diff is not working when providing the options to Foreign Data Wrapper, Foreign Server, and User Mapping.

View File

@ -231,18 +231,22 @@ def load_servers(args):
check_attrib("Name")
check_attrib("Group")
check_attrib("Port")
check_attrib("Username")
is_service_attrib_available = True if "Service" in obj else False
if not is_service_attrib_available:
check_attrib("Port")
check_attrib("Username")
check_attrib("SSLMode")
check_attrib("MaintenanceDB")
if "Host" not in obj and \
"HostAddr" not in obj and \
"Service" not in obj:
print("'Host', 'HostAddr' or 'Service' attribute not found "
"for server '%s'" % server)
print_summary()
sys.exit(1)
if "Host" not in obj and "HostAddr" not in obj:
if is_service_attrib_available is False:
print("'Host', 'HostAddr' or 'Service' attribute "
"not found for server '%s'" % server)
print_summary()
sys.exit(1)
# Get the group. Create if necessary
group_id = -1
@ -274,21 +278,24 @@ def load_servers(args):
new_server.name = obj["Name"]
new_server.servergroup_id = group_id
new_server.user_id = user_id
new_server.ssl_mode = obj["SSLMode"]
new_server.maintenance_db = obj["MaintenanceDB"]
new_server.host = obj["Host"]
if "Host" in obj:
new_server.host = obj["Host"]
if "HostAddr" in obj:
new_server.hostaddr = obj["HostAddr"]
new_server.port = obj["Port"]
new_server.maintenance_db = obj["MaintenanceDB"]
new_server.username = obj["Username"]
if "Port" in obj:
new_server.port = obj["Port"]
if "Username" in obj:
new_server.username = obj["Username"]
if "Role" in obj:
new_server.role = obj["Role"]
new_server.ssl_mode = obj["SSLMode"]
if "Comment" in obj:
new_server.comment = obj["Comment"]
@ -319,7 +326,7 @@ def load_servers(args):
if "FGColor" in obj:
new_server.fgcolor = obj["FGColor"]
if "Service" in obj:
if is_service_attrib_available:
new_server.service = obj["Service"]
if "Timeout" in obj: