JED WALKER <jedwa@comcast.net> writes:
> PostgreSQL v12.4 pg_dumpall output fails to load via "psql -f" load to empty instance/server.
> This occurs using check constraints that reference a function using data in a table that is loaded later.
That's never worked reliably, neither in v12 nor any other version.
The function is a "black box", so the fact that it creates an ordering
constraint isn't apparent to pg_dump.
Note that our documentation specifically disclaims correct enforcement
of CHECK constraints that reference any mutable data other than the row
being checked (see NOTEs at [1]). Even if the particular scenario you
describe here happened to work, there are many other cases where such a
constraint could become violated after it was initially checked --- and
Postgres wouldn't notice. Nor do we have any interest in making it
notice.
regards, tom lane
[1] https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS