pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

Table/Function dependency order

Open pettijohn opened this issue 9 months ago • 1 comments

pgschema 1.7.3 with file mode and plan database, PG 18, Ubuntu 24.04

Minimal repro here:

https://github.com/pettijohn/pgschema-bug

Run apply.sh and get Error: failed to apply desired state: failed to apply schema SQL to temporary schema pgschema_tmp_20260302_190352_4477b855: ERROR: relation "person_accounts" does not exist (SQLSTATE 42P01)

I'm using --file mode and explicitly create the tables followed by the function that depends on the tables. In schema.txt comment out the second include, the tables will apply correctly.

(Note, I am doing this in a dev container on a compose network, but I don't think that matters. I'm using the external plan database because the container runs as root and pgschema won't start the internal database as root.)

pettijohn avatar Mar 02 '26 19:03 pettijohn

Thank you! This is such a great tool, and I really appreciate the very quick turnaround on the bug!

pettijohn avatar Mar 03 '26 18:03 pettijohn