diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 76226de485..bdb7129ef5 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -6005,12 +6005,7 @@ getTables(Archive *fout, int *numTables)
 
 	if (fout->remoteVersion >= 90600)
 		appendPQExpBufferStr(query,
-							 "c.relkind = " CppAsString2(RELKIND_SEQUENCE)
-							 " AND EXISTS (SELECT 1 FROM pg_depend "
-							 "WHERE classid = 'pg_class'::regclass AND "
-							 "objid = c.oid AND objsubid = 0 AND "
-							 "refclassid = 'pg_class'::regclass AND "
-							 "deptype = 'i') AS is_identity_sequence, ");
+							 "(d.deptype = 'i') IS TRUE AS is_identity_sequence, ");
 	else
 		appendPQExpBufferStr(query,
 							 "false AS is_identity_sequence, ");
