Skip to content

Commit 01f99e2

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 02e6418 commit 01f99e2

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
@@ -4406,10 +4406,10 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
44064406
* explicitly set or was just a default.
44074407
*
44084408
* attislocal doesn't exist before 7.3, either; in older databases
4409-
* we just assume that inherited columns had no local definition.
4409+
* we assume it's TRUE, else we'd fail to dump non-inherited atts.
44104410
*/
44114411
appendPQExpBuffer(q, "SELECT a.attnum, a.attname, a.atttypmod, -1 as attstattarget, a.attstorage, t.typstorage, "
4412-
"a.attnotnull, a.atthasdef, false as attisdropped, false as attislocal, "
4412+
"a.attnotnull, a.atthasdef, false as attisdropped, true as attislocal, "
44134413
"format_type(t.oid,a.atttypmod) as atttypname "
44144414
"from pg_attribute a left join pg_type t "
44154415
"on a.atttypid = t.oid "
@@ -4422,7 +4422,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
44224422
{
44234423
/* format_type not available before 7.1 */
44244424
appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, -1 as attstattarget, attstorage, attstorage as typstorage, "
4425-
"attnotnull, atthasdef, false as attisdropped, false as attislocal, "
4425+
"attnotnull, atthasdef, false as attisdropped, true as attislocal, "
44264426
"(select typname from pg_type where oid = atttypid) as atttypname "
44274427
"from pg_attribute a "
44284428
"where attrelid = '%u'::oid "

0 commit comments

Comments
 (0)