diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 736cca33d6..5f97bfc4b2 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3954,7 +3954,11 @@ listPartitions(const char *pattern, bool verbose, bool show_indexes,
 		}
 	}
 
-	appendPQExpBuffer(&buf, "\nWHERE c.relkind IN (%s)", relkind_str);
+	if (show_nested)
+		appendPQExpBuffer(&buf, "\nWHERE (c.relkind IN (%s) OR c3.relkind IN (%s))", relkind_str, relkind_str);
+	else
+		appendPQExpBuffer(&buf, "\nWHERE c.relkind IN (%s)", relkind_str);
+		
 	appendPQExpBufferStr(&buf, !show_nested ? " AND NOT c.relispartition\n" : "\n");
 
 	if (!pattern)
