mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-03 08:00:21 +08:00
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...
This commit is contained in:
parent
02e6418181
commit
01f99e2d20
@ -4406,10 +4406,10 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
|
||||
* explicitly set or was just a default.
|
||||
*
|
||||
* attislocal doesn't exist before 7.3, either; in older databases
|
||||
* we just assume that inherited columns had no local definition.
|
||||
* we assume it's TRUE, else we'd fail to dump non-inherited atts.
|
||||
*/
|
||||
appendPQExpBuffer(q, "SELECT a.attnum, a.attname, a.atttypmod, -1 as attstattarget, a.attstorage, t.typstorage, "
|
||||
"a.attnotnull, a.atthasdef, false as attisdropped, false as attislocal, "
|
||||
"a.attnotnull, a.atthasdef, false as attisdropped, true as attislocal, "
|
||||
"format_type(t.oid,a.atttypmod) as atttypname "
|
||||
"from pg_attribute a left join pg_type t "
|
||||
"on a.atttypid = t.oid "
|
||||
@ -4422,7 +4422,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
|
||||
{
|
||||
/* format_type not available before 7.1 */
|
||||
appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, -1 as attstattarget, attstorage, attstorage as typstorage, "
|
||||
"attnotnull, atthasdef, false as attisdropped, false as attislocal, "
|
||||
"attnotnull, atthasdef, false as attisdropped, true as attislocal, "
|
||||
"(select typname from pg_type where oid = atttypid) as atttypname "
|
||||
"from pg_attribute a "
|
||||
"where attrelid = '%u'::oid "
|
||||
|
Loading…
Reference in New Issue
Block a user