diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py index 161bc9e0e..2692bc026 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py @@ -228,7 +228,8 @@ class CheckConstraintView(PGChildNodeView): Returns: """ - self.conn.execute_void("END;") + SQL = "END;" + self.conn.execute_scalar(SQL) @check_precondition def list(self, gid, sid, did, scid, tid, cid=None): @@ -535,9 +536,8 @@ class CheckConstraintView(PGChildNodeView): if 'name' not in data or data['name'] == "": sql = "BEGIN;" # Start transaction. - status, res = self.conn.execute_void(sql) + status, res = self.conn.execute_scalar(sql) if not status: - self.conn.execute_void('ROLLBACK;') self.end_transaction() return internal_server_error(errormsg=res) @@ -549,7 +549,6 @@ class CheckConstraintView(PGChildNodeView): status, msg = self.conn.execute_scalar(sql) if not status: - self.conn.execute_void('ROLLBACK;') self.end_transaction() return internal_server_error(errormsg=msg) @@ -562,7 +561,6 @@ class CheckConstraintView(PGChildNodeView): status, res = self.conn.execute_dict(sql) if not status: - self.conn.execute_void('ROLLBACK;') self.end_transaction() return internal_server_error(errormsg=res) @@ -578,7 +576,6 @@ class CheckConstraintView(PGChildNodeView): ) status, res = self.conn.execute_dict(sql) if not status: - self.conn.execute_void('ROLLBACK;') self.end_transaction() return internal_server_error(errormsg=res) @@ -595,7 +592,6 @@ class CheckConstraintView(PGChildNodeView): ) except Exception as e: - self.conn.execute_void('ROLLBACK;') self.end_transaction() return make_json_response( status=400, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/check_constraint_test_data.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/check_constraint_test_data.json index 5f8dd7f5f..28debaf33 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/check_constraint_test_data.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/check_constraint_test_data.json @@ -469,7 +469,7 @@ }, "mocking_required": true, "mock_data": { - "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_void", + "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar", "return_value": "(False,'Mocked Internal Server Error')" }, "expected_data": { @@ -547,7 +547,7 @@ "test_data": {}, "mocking_required": true, "mock_data": { - "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_void", + "function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar", "return_value": "(False,'Mocked Internal Server Error')" }, "expected_data": {