Skip to content

Commit 5466072

Browse files
committed
Fix brain fade in previous pg_dump patch.
In pre-7.3 databases, pg_attribute.attislocal doesn't exist. The easiest way to make sure the new inheritance logic behaves sanely is to assume it's TRUE, not FALSE. This will result in printing child columns even when they're not really needed. We could work harder at trying to reconstruct a value for attislocal, but there is little evidence that anyone still cares about dumping from such old versions, so just do the minimum necessary to have a valid dump. I had this correct in the original draft of the patch, but for some unaccountable reason decided it wasn't necessary to change the value. Testing against an old server shows otherwise...
1 parent ab060c7 commit 5466072

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5202,13 +5202,13 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
52025202
* explicitly set or was just a default.
52035203
*
52045204
* attislocal doesn't exist before 7.3, either; in older databases
5205-
* we just assume that inherited columns had no local definition.
5205+
* we assume it's TRUE, else we'd fail to dump non-inherited atts.
52065206
*/
52075207
appendPQExpBuffer(q, "SELECT a.attnum, a.attname, a.atttypmod, "
52085208
"-1 AS attstattarget, a.attstorage, "
52095209
"t.typstorage, a.attnotnull, a.atthasdef, "
52105210
"false AS attisdropped, a.attlen, "
5211-
"a.attalign, false AS attislocal, "
5211+
"a.attalign, true AS attislocal, "
52125212
"format_type(t.oid,a.atttypmod) AS atttypname, "
52135213
"'' AS attoptions "
52145214
"FROM pg_attribute a LEFT JOIN pg_type t "
@@ -5226,7 +5226,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
52265226
"attstorage, attstorage AS typstorage, "
52275227
"attnotnull, atthasdef, false AS attisdropped, "
52285228
"attlen, attalign, "
5229-
"false AS attislocal, "
5229+
"true AS attislocal, "
52305230
"(SELECT typname FROM pg_type WHERE oid = atttypid) AS atttypname, "
52315231
"'' AS attoptions "
52325232
"FROM pg_attribute a "

0 commit comments

Comments
 (0)