Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source code of function is different #8450

Open
samuele555 opened this issue Feb 12, 2025 · 0 comments
Open

Source code of function is different #8450

samuele555 opened this issue Feb 12, 2025 · 0 comments
Labels

Comments

@samuele555
Copy link

Describe the bug

When using function -> CREATE Script action, the source code show in the window is different if the function is opened with another Database Editor. For example in the beginning of the function after language 'plpgsql' statement there is this:

    COST 100
    VOLATILE PARALLEL UNSAFE
AS $BODY$

instead it should have

AS $function$

and at the bottom of the function pgAdmin returns:

$BODY$;

ALTER FUNCTION REDACTED_SCHEMA.REDACTED_FUNCTION(character varying)
    OWNER TO REDACTED_DB_USER;

GRANT EXECUTE ON FUNCTION REDACTED_SCHEMA.REDACTED_FUNCTION(character varying) TO "REDACTED_USER";

GRANT EXECUTE ON FUNCTION REDACTED_SCHEMA.REDACTED_FUNCTION(character varying) TO PUBLIC;

GRANT EXECUTE ON FUNCTION REDACTED_SCHEMA.REDACTED_FUNCTION(character varying) TO REDACTED_DB_USER;

while both the query and other db editors return:

$function$;

this is shown also if using the following query to retrieve function code from catalog tables:

SELECT 	n.nspname AS schema_name,
       	p.proname AS function_name,
       	pg_get_functiondef(p.oid) AS function_definition
FROM 	pg_proc p
		JOIN pg_namespace n ON p.pronamespace = n.oid
WHERE 	n.nspname NOT IN ('pg_catalog', 'information_schema')
		and n.nspname = 'REDACTED_SCHEMA_NAME'
		and p.proname = 'REDACTED_FUNCTION_NAME';		

To Reproduce

Choose a Function under any schema open it and compare the source code with the one returned by the query listed above

Expected behavior

The code should be the same if browse from different editors, but most importantly it should be the same if retrieved using queries which should have the actual code stored on the server instead of a coded version by pgadmin editor

Error message

No errors are shown

Screenshots

Can't add screenshots of actual code

Desktop (please complete the following information):

  • OS: Windows 11, 23H2
  • Mode: Desktop
  • Package type: ?
  • PgAdmin version: 8.14

Additional context

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

1 participant