diff --git a/backup/predata_externals_test.go b/backup/predata_externals_test.go index 2eac072f..a9515d97 100644 --- a/backup/predata_externals_test.go +++ b/backup/predata_externals_test.go @@ -95,7 +95,11 @@ var _ = Describe("backup/predata_externals tests", func() { extTableDef.URIs = []string{"file://host:port/path/file"} testTable.ExtTableDef = extTableDef backup.PrintExternalTableCreateStatement(backupfile, tocfile, testTable) - testutils.ExpectEntry(tocfile.PredataEntries, 0, "public", "", "tablename", toc.OBJ_TABLE) + expectedObjectType := toc.OBJ_TABLE + if (connectionPool.Version.IsGPDB() && connectionPool.Version.AtLeast("7")) || connectionPool.Version.IsCBDB() { + expectedObjectType = toc.OBJ_FOREIGN_TABLE + } + testutils.ExpectEntry(tocfile.PredataEntries, 0, "public", "", "tablename", expectedObjectType) testutils.AssertBufferContents(tocfile.PredataEntries, buffer, `CREATE READABLE EXTERNAL TABLE public.tablename ( ) LOCATION ( 'file://host:port/path/file' diff --git a/backup/queries_table_defs.go b/backup/queries_table_defs.go index 5edb1040..4c6bf612 100644 --- a/backup/queries_table_defs.go +++ b/backup/queries_table_defs.go @@ -32,6 +32,9 @@ func (t Table) GetMetadataEntry() (string, toc.MetadataEntry) { if (t.ForeignDef != ForeignTableDefinition{}) { objectType = toc.OBJ_FOREIGN_TABLE } + if t.IsExternal && ((connectionPool.Version.IsGPDB() && connectionPool.Version.AtLeast("7")) || connectionPool.Version.IsCBDB()) { + objectType = toc.OBJ_FOREIGN_TABLE + } referenceObject := "" if t.AttachPartitionInfo != (AttachPartitionInfo{}) { referenceObject = t.AttachPartitionInfo.Parent