@ -13126,7 +13126,8 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
* attislocal correctly , plus fix up any inherited CHECK constraints .
* attislocal correctly , plus fix up any inherited CHECK constraints .
* Analogously , we set up typed tables using ALTER TABLE / OF here .
* Analogously , we set up typed tables using ALTER TABLE / OF here .
*/
*/
if ( binary_upgrade & & tbinfo - > relkind = = RELKIND_RELATION )
if ( binary_upgrade & & ( tbinfo - > relkind = = RELKIND_RELATION | |
tbinfo - > relkind = = RELKIND_FOREIGN_TABLE ) )
{
{
for ( j = 0 ; j < tbinfo - > numatts ; j + + )
for ( j = 0 ; j < tbinfo - > numatts ; j + + )
{
{
@ -13144,13 +13145,19 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
appendStringLiteralAH ( q , fmtId ( tbinfo - > dobj . name ) , fout ) ;
appendStringLiteralAH ( q , fmtId ( tbinfo - > dobj . name ) , fout ) ;
appendPQExpBuffer ( q , " ::pg_catalog.regclass; \n " ) ;
appendPQExpBuffer ( q , " ::pg_catalog.regclass; \n " ) ;
appendPQExpBuffer ( q , " ALTER TABLE ONLY %s " ,
if ( tbinfo - > relkind = = RELKIND_RELATION )
fmtId ( tbinfo - > dobj . name ) ) ;
appendPQExpBuffer ( q , " ALTER TABLE ONLY %s " ,
fmtId ( tbinfo - > dobj . name ) ) ;
else
appendPQExpBuffer ( q , " ALTER FOREIGN TABLE %s " ,
fmtId ( tbinfo - > dobj . name ) ) ;
appendPQExpBuffer ( q , " DROP COLUMN %s; \n " ,
appendPQExpBuffer ( q , " DROP COLUMN %s; \n " ,
fmtId ( tbinfo - > attnames [ j ] ) ) ;
fmtId ( tbinfo - > attnames [ j ] ) ) ;
}
}
else if ( ! tbinfo - > attislocal [ j ] )
else if ( ! tbinfo - > attislocal [ j ] )
{
{
Assert ( tbinfo - > relkind ! = RELKIND_FOREIGN_TABLE ) ;
appendPQExpBuffer ( q , " \n -- For binary upgrade, recreate inherited column. \n " ) ;
appendPQExpBuffer ( q , " \n -- For binary upgrade, recreate inherited column. \n " ) ;
appendPQExpBuffer ( q , " UPDATE pg_catalog.pg_attribute \n "
appendPQExpBuffer ( q , " UPDATE pg_catalog.pg_attribute \n "
" SET attislocal = false \n "
" SET attislocal = false \n "