From 7997f3e260a4d8ac0c6b6266415f46efc32008f7 Mon Sep 17 00:00:00 2001 From: Yugo Nagata Date: Fri, 27 Jan 2023 15:25:58 +0900 Subject: [PATCH] Remove a unnecessary function call It was added by 3de95c09 for consistency with the patch version proposed for PostgreSQL core, but the called function was not one we intended. Fortunately, the behavior has not been affected. Now, I decided to remove this funciton since I come to think it is confusable. Also, added some comments on an argument left for the similar consistency. --- createas.c | 14 ++++++++++++++ matview.c | 3 --- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/createas.c b/createas.c index efe777c..31fd06b 100644 --- a/createas.c +++ b/createas.c @@ -466,6 +466,13 @@ CreateIvmTriggersOnBaseTables(Query *qry, Oid matviewOid, bool is_create) Index first_rtindex = is_create ? 1 : PRS2_NEW_VARNO + 1; RangeTblEntry *rte; + /* + * is_create must be true in pg_ivm because the view definition doesn't + * contain NEW/OLD RTE. + * XXX: This argument should be removed? + */ + Assert(is_create); + /* Immediately return if we don't have any base tables. */ if (list_length(qry->rtable) < first_rtindex) return; @@ -1095,6 +1102,13 @@ CreateIndexOnIMMV(Query *query, Relation matviewRel, bool is_create) ListCell *indexoidscan; + /* + * is_create must be true in pg_ivm because the view definition doesn't + * contain NEW/OLD RTE. + * XXX: This argument should be removed? + */ + Assert(is_create); + /* * For aggregate without GROUP BY, we do not need to create an index * because the view has only one row. diff --git a/matview.c b/matview.c index 6e4208f..ae2b02b 100644 --- a/matview.c +++ b/matview.c @@ -447,10 +447,7 @@ ExecRefreshImmv(const RangeVar *relation, bool skipData, pgstat_count_heap_insert(matviewRel, processed); if (!skipData && !oldPopulated) - { CreateIvmTriggersOnBaseTables(viewQuery, matviewOid, true); - CreateIvmTriggersOnBaseTables(dataQuery, matviewOid, false); - } table_close(matviewRel, NoLock);