pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

`dump --multi-file` generates non-deterministic include order in main.sql

Open imm opened this issue 9 months ago • 0 comments

Hi, thanks for pgschema.

When I run pgschema dump --multi-file multiple times on the same unchanged database, the order of \i ... lines in main.sql changes between runs.

This creates noisy diffs in Git, even when schema did not change.

Repro

  1. pgschema version: 1.7.1
  2. Run dump twice (or more) with same DB and same options (different output folders): pgschema dump --multi-file --file <schema_dir_A>/main.sql ... pgschema dump --multi-file --file <schema_dir_B>/main.sql ...
  3. Compare generated main.sql files

Actual result

main.sql include lines are shuffled between runs.

Expected result

Deterministic output: same include order every run for unchanged schema.

Note

Looks like object grouping is done via Go maps and iteration order may be random. Could you sort object keys before writing files/includes in multi-file formatter?

Thanks!

imm avatar Feb 19 '26 17:02 imm