Fixed an issue where incorrect select/exec scripts were generated for functions/procedures. #7334

This commit is contained in:
Akshay Joshi 2024-04-25 17:23:38 +05:30
parent eeee45e57c
commit 92bb931b0a
2 changed files with 21 additions and 28 deletions

View File

@ -32,11 +32,13 @@ Housekeeping
Bug fixes
*********
| `Issue #2410 <https://github.com/pgadmin-org/pgadmin4/issues/2410>`_ - Fixed all input boxes in pgAdmin to show browser auto-fill only where it is relevant.
| `Issue #7173 <https://github.com/pgadmin-org/pgadmin4/issues/7173>`_ - Install dbus-python, an in-direct dependency of the Keyring package as a system package for Debian platforms.
| `Issue #7275 <https://github.com/pgadmin-org/pgadmin4/issues/7275>`_ - Fixed an issue where debugger was not scrolling automatically on stepping.
| `Issue #7282 <https://github.com/pgadmin-org/pgadmin4/issues/7282>`_ - Fixed an XSS vulnerability in the /settings/store endpoint.
| `Issue #7294 <https://github.com/pgadmin-org/pgadmin4/issues/7294>`_ - Fixed an issue where double dollar quoted code is treated as string in syntax highlighter.
| `Issue #7317 <https://github.com/pgadmin-org/pgadmin4/issues/7317>`_ - Fixed an issue where pressing backspace should remove the spaces and not the entire tab width, on enabling 'Use spaces?' in the preferences.
| `Issue #7334 <https://github.com/pgadmin-org/pgadmin4/issues/7334>`_ - Fixed an issue where incorrect select/exec scripts were generated for functions/procedures.
| `Issue #7372 <https://github.com/pgadmin-org/pgadmin4/issues/7372>`_ - Fixed an issue where connection to the database is not automatically re-established after connectivity drop.
| `Issue #7384 <https://github.com/pgadmin-org/pgadmin4/issues/7384>`_ - Fixed an issue when closing the view data second tab; it raises the error that the 'ViewCommand' object has no attribute 'auto_commit'.
| `Issue #7390 <https://github.com/pgadmin-org/pgadmin4/issues/7390>`_ - Fixed violates check constraint issue when creating a pgAgent schedule.

View File

@ -1521,23 +1521,18 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
if len(res['rows']) == 0:
return gone(gettext("The specified function could not be found."))
# Fetch only arguments
arg_string = res['rows'][0]['func_with_identity_arguments']
# Split argument by comma, Remove unwanted spaces and,
# format argument like "\n\t <args>"
args = ','.join(
['\n\t<' + arg.strip(' ') + '>' for arg in arg_string.split(',')]
) + '\n' if len(arg_string) > 0 else ''
name = self.qtIdent(
self.conn, res['rows'][0]['nspname'],
res['rows'][0]['proname']
) + '(' + res['rows'][0]['func_with_identity_arguments'] + ')'
# Fetch only arguments
arg_string = name[name.rfind('('):].strip('(').strip(')')
if len(arg_string) > 0:
args = arg_string.split(',')
# Remove unwanted spaces from arguments
args = [arg.strip(' ') for arg in args]
# Remove duplicate and then format arguments
for arg in list(set(args)):
formatted_arg = '\n\t<' + arg + '>'
name = name.replace(arg, formatted_arg)
name = name.replace(')', '\n)')
) + '(' + args + ')'
sql = "SELECT {0}".format(name)
@ -1566,22 +1561,18 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
resp_data['pronamespace']
)
name = resp_data['pronamespace'] + "." + resp_data['name_with_args']
# Fetch only arguments
if name.rfind('(') != -1:
args = name[name.rfind('('):].strip('(').strip(')').split(',')
# Remove unwanted spaces from arguments
args = [arg.strip(' ') for arg in args]
arg_string = resp_data['proargs']
# Split argument by comma, Remove unwanted spaces and,
# format argument like "\n\t <args>"
args = ','.join(
['\n\t<' + arg.strip(' ') + '>' for arg in arg_string.split(',')]
) + '\n' if len(arg_string) > 0 else ''
# Remove duplicate and then format arguments
for arg in list(set(args)):
formatted_arg = '\n\t<' + arg + '>'
name = name.replace(arg, formatted_arg)
name = name.replace(')', '\n)')
else:
name += '()'
name = self.qtIdent(
self.conn, resp_data['pronamespace'],
resp_data['proname']
) + '(' + args + ')'
if self.manager.server_type == 'pg':
sql = "CALL {0}".format(name)