diff --git a/src/bin/pg_dump/pg_dump.cpp b/src/bin/pg_dump/pg_dump.cpp index c3d264139..54871b0da 100644 --- a/src/bin/pg_dump/pg_dump.cpp +++ b/src/bin/pg_dump/pg_dump.cpp @@ -23644,7 +23644,9 @@ static void dumpTableAutoIncrement(Archive* fout, PQExpBuffer sqlbuf, TableInfo* "pg_class c left join pg_namespace n on c.relnamespace = n.oid " "left join pg_depend d on c.oid = d.objid " "where classid = %u and deptype = '%c' and refobjid = %u and refobjsubid = %u " - ,RelationRelationId, DEPENDENCY_AUTO, tbinfo->dobj.catId.oid, tbinfo->autoinc_attnum); + "and c.relkind in ('%c', '%c')" + ,RelationRelationId, DEPENDENCY_AUTO, tbinfo->dobj.catId.oid, tbinfo->autoinc_attnum + ,RELKIND_SEQUENCE, RELKIND_LARGE_SEQUENCE); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); if (PQntuples(res) != 1) {