Skip to content

Schema Diff: applying a function or procedure change leaves a whitespace-only difference behind #10302

Description

@dpage

Bug Description

Applying a Schema Diff script that updates a function or procedure leaves a whitespace-only difference behind, so comparing the two databases again still reports the object as different unless 'Ignore whitespace' is ticked.

The generated CREATE OR REPLACE wraps the body in newlines:

CREATE OR REPLACE PROCEDURE test_schema_diff.proc1(
	IN arg1 bigint)
LANGUAGE 'sql'
AS $BODY$
select 1;
$BODY$;

so the target's prosrc becomes "\nselect 1;\n" whilst the source's remains "select 1;". The bodies now differ by exactly the newlines pgAdmin itself introduced, and the comparison duly reports it.

It is cosmetic in that the two functions behave identically, and ticking 'Ignore whitespace' hides it, but a script that cannot settle the difference it was generated for is confusing: re-running the comparison suggests the script did not work.

Expected Behaviour

Applying the generated script should leave the object comparing as identical without needing 'Ignore whitespace', which means either rendering the body exactly as it is stored, or normalising the stored body on both sides before comparing.

Context

Found by making the Schema Diff regression test assert that applying the generated script leaves the two databases identical (#10293). The test lists this as a known outstanding difference until it is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions