!53 Fix fdw analyze bug.

Merge pull request !53 from TotaJ/bugfix/fdw
This commit is contained in:
opengauss-bot
2020-07-27 20:03:42 +08:00
committed by Gitee
2 changed files with 14 additions and 2 deletions

View File

@ -551,6 +551,8 @@ static void analyze_rel_internal(Relation onerel, VacuumStmt* vacstmt, BufferAcc
retValue = fdwroutine->AnalyzeForeignTable(onerel, &acquirefunc, &relpages, 0, false);
}
if (!retValue) {
/* Supress warning info for mysql_fdw */
messageLevel = isMysqlFDWFromTblOid(RelationGetRelid(onerel)) ? LOG : messageLevel;
ereport(messageLevel,
(errmsg(
"Skipping \"%s\" --- cannot analyze this foreign table.", RelationGetRelationName(onerel))));
@ -886,7 +888,8 @@ HeapTuple* get_total_rows(Relation onerel, VacuumStmt* vacstmt, BlockNumber relp
*numrows = acquirePartitionedSampleRows<estimate_table_rownum>(
onerel, vacstmt, elevel, rows, target_rows, totalrows, totaldeadrows, vacattrstats, attr_cnt);
} else if (isForeignTable ||
(onerel->rd_rel->relkind == RELKIND_FOREIGN_TABLE && isMOTFromTblOid(RelationGetRelid(onerel)))) {
(onerel->rd_rel->relkind == RELKIND_FOREIGN_TABLE &&
(isMOTFromTblOid(RelationGetRelid(onerel)) || isOracleFDWFromTblOid(RelationGetRelid(onerel))))) {
/*
* @hdfs processing foreign table sampling operation
* get foreign table FDW routine

View File

@ -20,7 +20,7 @@ index 5f8b100..7fdd24f 100644
+override CPPFLAGS := $(filter-out $(exclude_option),$(CPPFLAGS))
\ No newline at end of file
diff --git oracle_fdw.cpp oracle_fdw.cpp
index e75b6ab..7e83a4f 100644
index e75b6ab..c7eec41 100644
--- oracle_fdw.cpp
+++ oracle_fdw.cpp
@@ -92,13 +92,13 @@
@ -121,6 +121,15 @@ index e75b6ab..7e83a4f 100644
#ifdef IMPORT_API
static char *fold_case(char *name, fold_t foldcase, int collation);
#endif /* IMPORT_API */
@@ -403,7 +404,7 @@ PGDLLEXPORT Datum
oracle_fdw_handler(PG_FUNCTION_ARGS)
{
FdwRoutine *fdwroutine = makeNode(FdwRoutine);
-
+ fdwroutine->AcquireSampleRows = acquireSampleRowsFunc;
#ifdef OLD_FDW_API
fdwroutine->PlanForeignScan = oraclePlanForeignScan;
#else
@@ -457,7 +458,7 @@ oracle_fdw_validator(PG_FUNCTION_ARGS)
Oid catalog = PG_GETARG_OID(1);
ListCell *cell;