diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index a2f84cc0aae..715c00e33bd 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -173,6 +173,13 @@ static int extra_float_digits; */ #define DUMP_DEFAULT_ROWS_PER_INSERT 1 +/* + * FIXME: CBDB should not know the am oid of PAX. We put here because the kernel + * can't distinguish the PAX and renamed heap(heap_psql) in test `psql`. + * The definition of temporary is here and should be consistent with util/rel.h + */ +#define PAX_AM_OID 7047 + /* * Macro for producing quoted, schema-qualified name of a dumpable object. */ @@ -2098,6 +2105,16 @@ selectDumpableTable(TableInfo *tbinfo, Archive *fout) simple_oid_list_member(&table_exclude_oids, tbinfo->dobj.catId.oid)) tbinfo->dobj.dump = DUMP_COMPONENT_NONE; + + /* + * Pax not support pg_dump yet + */ + if (tbinfo->amoid == PAX_AM_OID) { + tbinfo->dobj.dump = DUMP_COMPONENT_NONE; + + pg_log_warning("unsupport am pax yet, current relation \"%s\" will be ignore", + tbinfo->dobj.name); + } } /* @@ -7387,6 +7404,7 @@ getTables(Archive *fout, int *numTables) int i_ispartition; int i_partbound; int i_amname; + int i_amoid; int i_isivm; /* @@ -7479,6 +7497,7 @@ getTables(Archive *fout, int *numTables) "tc.relminmxid AS tminmxid, " "c.relpersistence, c.relispopulated, " "c.relreplident, c.relpages, am.amname, " + "am.oid AS amoid, " "CASE WHEN c.relkind = 'f' THEN " "(SELECT ftserver FROM pg_catalog.pg_foreign_table WHERE ftrelid = c.oid) " "ELSE 0 END AS foreignserver, " @@ -8076,6 +8095,7 @@ getTables(Archive *fout, int *numTables) i_ispartition = PQfnumber(res, "ispartition"); i_partbound = PQfnumber(res, "partbound"); i_amname = PQfnumber(res, "amname"); + i_amoid = PQfnumber(res, "amoid"); i_isivm = PQfnumber(res, "isivm"); if (dopt->lockWaitTimeout) @@ -8167,6 +8187,11 @@ getTables(Archive *fout, int *numTables) else tblinfo[i].amname = pg_strdup(PQgetvalue(res, i, i_amname)); + if (PQgetisnull(res, i, i_amoid)) + tblinfo[i].amoid = InvalidOid; + else + tblinfo[i].amoid = atooid(PQgetvalue(res, i, i_amoid)); + /* other fields were zeroed above */ /* diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index 3fa4d6448a0..a907a9af16e 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -383,6 +383,7 @@ typedef struct _tableInfo char *partbound; /* partition bound definition */ bool needs_override; /* has GENERATED ALWAYS AS IDENTITY */ char *amname; /* relation access method */ + Oid amoid; /* relation access method oid */ /* * Stuff computed only for dumpable tables.