Skip to content

Commit 97dc3c8

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 00bc96b commit 97dc3c8

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
@@ -5835,13 +5835,13 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
58355835
* explicitly set or was just a default.
58365836
*
58375837
* attislocal doesn't exist before 7.3, either; in older databases
5838-
* we just assume that inherited columns had no local definition.
5838+
* we assume it's TRUE, else we'd fail to dump non-inherited atts.
58395839
*/
58405840
appendPQExpBuffer(q, "SELECT a.attnum, a.attname, a.atttypmod, "
58415841
"-1 AS attstattarget, a.attstorage, "
58425842
"t.typstorage, a.attnotnull, a.atthasdef, "
58435843
"false AS attisdropped, a.attlen, "
5844-
"a.attalign, false AS attislocal, "
5844+
"a.attalign, true AS attislocal, "
58455845
"format_type(t.oid,a.atttypmod) AS atttypname, "
58465846
"'' AS attoptions, 0 AS attcollation, "
58475847
"NULL AS attfdwoptions "
@@ -5860,7 +5860,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
58605860
"attstorage, attstorage AS typstorage, "
58615861
"attnotnull, atthasdef, false AS attisdropped, "
58625862
"attlen, attalign, "
5863-
"false AS attislocal, "
5863+
"true AS attislocal, "
58645864
"(SELECT typname FROM pg_type WHERE oid = atttypid) AS atttypname, "
58655865
"'' AS attoptions, 0 AS attcollation, "
58665866
"NULL AS attfdwoptions "

0 commit comments

Comments
 (0)