All,
A quick note on a design change I made in the pg_get_table_ddl option surface.
The earlier draft exposed one boolean option per sub-object kind: include_indexes, include_primary_key, include_check, include_foreign_keys, include_rules, include_statistics, include_rls, include_replica_identity, include_partitions, and so on. Every new kind we wanted to gate (triggers, policies, exclusion constraints…) meant another option name. Callers wanting "everything except FKs" had to flip nine flags, and the include/exclude polarity was not symmetric: to drop one item, you toggled one flag, but to keep only one item, you toggled all the others.
I have replaced those with two options:
- include — comma-separated list of kinds; emit only the listed ones.
- exclude — comma-separated list of kinds; emit everything except the listed ones.
Vocabulary: table, indexes, primary_key, unique, check, foreign_keys, exclusion, rules, statistics, triggers, policies, rls, replica_identity, partitions.
NOT NULL is intentionally omitted from the vocabulary; it's always emitted to avoid silently producing schemas that accept NULLs when the source would have rejected them.
The v10 patch is ready for review.