diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 94459b3539..6ec5c377ed 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -16247,6 +16247,15 @@ dumpAttrDef(Archive *fout, AttrDefInfo *adinfo)
 	if (!adinfo->separate)
 		return;
 
+	/*
+	 * Skip if the column is not local and a generated column; the
+	 * inherited column must have the same generation expression as
+	 * the expression the parent has and we don't support setting the
+	 * generation expression on the column by ALTER TABLE.
+	 */
+	if (!tbinfo->attislocal[adnum - 1] && tbinfo->attgenerated[adnum - 1])
+		return;
+
 	q = createPQExpBuffer();
 	delq = createPQExpBuffer();
 
