From 78a21f412b65aa36979a395ac74679debae13f09 Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Sat, 27 Feb 2021 12:25:00 +0100 Subject: [PATCH] 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 --- .github/workflows/postgres_dev.yaml | 2 +- src/copy.c | 7 +++++++ src/planner.c | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/postgres_dev.yaml b/.github/workflows/postgres_dev.yaml index c1125c56f..8dd0a0a76 100644 --- a/.github/workflows/postgres_dev.yaml +++ b/.github/workflows/postgres_dev.yaml @@ -10,7 +10,7 @@ jobs: PG_INSTALL_DIR: postgresql MAKE_JOBS: 2 # postgres version to build against this can either be commit hash, branch or tag - PG_COMMIT: 3d351d916b + PG_COMMIT: 1375422 CLANG: clang-9 LLVM_CONFIG: llvm-config-9 CC: gcc diff --git a/src/copy.c b/src/copy.c index b9f186d39..532583d85 100644 --- a/src/copy.c +++ b/src/copy.c @@ -241,8 +241,10 @@ copyfrom(CopyChunkState *ccstate, List *range_table, Hypertable *ht, void (*call ExecOpenIndices(resultRelInfo, false); +#if PG14_LT estate->es_result_relations = resultRelInfo; estate->es_num_result_relations = 1; +#endif estate->es_result_relation_info = resultRelInfo; estate->es_range_table = range_table; @@ -446,7 +448,12 @@ copyfrom(CopyChunkState *ccstate, List *range_table, Hypertable *ht, void (*call ExecCloseIndices(resultRelInfo); /* Close any trigger target relations */ +#if PG14_LT ExecCleanUpTriggerState(estate); +#else + ExecCloseResultRelations(estate); + ExecCloseRangeTableRelations(estate); +#endif /* * If we skipped writing WAL, then we need to sync the heap (but not diff --git a/src/planner.c b/src/planner.c index 4dfc2b29d..1ca24d56f 100644 --- a/src/planner.c +++ b/src/planner.c @@ -330,7 +330,8 @@ timescaledb_planner(Query *parse, int cursor_opts, ParamListInfo bound_params) { Plan *subplan = (Plan *) lfirst(lc); - ts_hypertable_insert_fixup_tlist(subplan); + if (subplan) + ts_hypertable_insert_fixup_tlist(subplan); } } }