8000 Fix brain fade in previous pg_dump patch. · jcsston/postgres@e1fcf16 · GitHub
[go: up one dir, main page]

Skip to content

Commit e1fcf16

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 0951f4d commit e1fcf16

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
@@ -4798,13 +4798,13 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
47984798
* explicitly set or was just a default.
47994799
*
48004800
* attislocal doesn't exist before 7.3, either; in older databases
4801-
* we just assume that inherited columns had no local definition.
4801+
* we assume it's TRUE, else we'd fail to dump non-inherited atts.
48024802
*/
48034803
appendPQExpBuffer(q, "SELECT a.attnum, a.attname, "
48044804
"a.atttypmod, -1 AS attstattarget, a.attstorage, "
48054805
"t.typstorage, a.attnotnull, a.atthasdef, "
48064806
"false AS attisdropped, a.attlen, "
4807-
"a.attalign, false AS attislocal, "
4807+
"a.attalign, true AS attislocal, "
48084808
"format_type(t.oid,a.atttypmod) AS atttypname "
48094809
"FROM pg_attribute a LEFT JOIN pg_type t "
48104810
"ON a.atttypid = t.oid "
@@ -4821,7 +4821,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
48214821
"attstorage AS typstorage, "
48224822
"attnotnull, atthasdef, false AS attisdropped, "
48234823
"attlen, attalign, "
4824-
"false AS attislocal, "
4824+
"true AS attislocal, "
48254825
"(SELECT typname FROM pg_type WHERE oid = atttypid) AS atttypname "
48264826
"FROM pg_attribute a "
48274827
"WHERE attrelid = '%u'::oid "

0 commit comments

Comments
 (0)
0