diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 784bceaec3..3406388872 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -8644,9 +8644,10 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) PQclear(res); /* - * Get info about column defaults + * Get info about column defaults. This is skipped for a data-only + * dump, as it is only needed for table schemas. */ - if (hasdefaults) + if (!dopt->dataOnly && hasdefaults) { AttrDefInfo *attrdefs; int numDefaults; @@ -8731,9 +8732,10 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) } /* - * Get info about table CHECK constraints + * Get info about table CHECK constraints. This is skipped for a + * data-only dump, as it is only needed for table schemas. */ - if (tbinfo->ncheck > 0) + if (!dopt->dataOnly && tbinfo->ncheck > 0) { ConstraintInfo *constrs; int numConstrs;