Adjust copy code to PG14 changes

PG14 changes initialization of ResultRelInfo, removes
es_num_result_relations and changes es_result_relations into an
array index by rangetable index.

https://github.com/postgres/postgres/commit/1375422c78
This commit is contained in:
Sven Klemm 2021-02-27 12:25:00 +01:00 committed by Sven Klemm
parent d607e3d714
commit 78a21f412b
3 changed files with 10 additions and 2 deletions

View File

@ -10,7 +10,7 @@ jobs:
PG_INSTALL_DIR: postgresql PG_INSTALL_DIR: postgresql
MAKE_JOBS: 2 MAKE_JOBS: 2
# postgres version to build against this can either be commit hash, branch or tag # postgres version to build against this can either be commit hash, branch or tag
PG_COMMIT: 3d351d916b PG_COMMIT: 1375422
CLANG: clang-9 CLANG: clang-9
LLVM_CONFIG: llvm-config-9 LLVM_CONFIG: llvm-config-9
CC: gcc CC: gcc

View File

@ -241,8 +241,10 @@ copyfrom(CopyChunkState *ccstate, List *range_table, Hypertable *ht, void (*call
ExecOpenIndices(resultRelInfo, false); ExecOpenIndices(resultRelInfo, false);
#if PG14_LT
estate->es_result_relations = resultRelInfo; estate->es_result_relations = resultRelInfo;
estate->es_num_result_relations = 1; estate->es_num_result_relations = 1;
#endif
estate->es_result_relation_info = resultRelInfo; estate->es_result_relation_info = resultRelInfo;
estate->es_range_table = range_table; estate->es_range_table = range_table;
@ -446,7 +448,12 @@ copyfrom(CopyChunkState *ccstate, List *range_table, Hypertable *ht, void (*call
ExecCloseIndices(resultRelInfo); ExecCloseIndices(resultRelInfo);
/* Close any trigger target relations */ /* Close any trigger target relations */
#if PG14_LT
ExecCleanUpTriggerState(estate); ExecCleanUpTriggerState(estate);
#else
ExecCloseResultRelations(estate);
ExecCloseRangeTableRelations(estate);
#endif
/* /*
* If we skipped writing WAL, then we need to sync the heap (but not * If we skipped writing WAL, then we need to sync the heap (but not

View File

@ -330,7 +330,8 @@ timescaledb_planner(Query *parse, int cursor_opts, ParamListInfo bound_params)
{ {
Plan *subplan = (Plan *) lfirst(lc); Plan *subplan = (Plan *) lfirst(lc);
ts_hypertable_insert_fixup_tlist(subplan); if (subplan)
ts_hypertable_insert_fixup_tlist(subplan);
} }
} }
} }