RE: Implementing Incremental View Maintenance

From: "r(dot)takahashi_2(at)fujitsu(dot)com" <r(dot)takahashi_2(at)fujitsu(dot)com>
To: 'Zhihong Yu' <zyu(at)yugabyte(dot)com>, Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: RE: Implementing Incremental View Maintenance
Date: 2021-09-06 10:06:37
Message-ID: OS0PR01MB56829A65926C0FF7CF00F5EB82D29@OS0PR01MB5682.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Nagata-san,

I'm still reading the patch.
I have additional comments.

(1)
In v23-0001-Add-a-syntax-to-create-Incrementally-Maintainabl.patch, ivm member is added to IntoClause struct.
I think it is necessary to modify _copyIntoClause() and _equalIntoClause() functions.

(2)
By executing pg_dump with v23-0005-Add-Incremental-View-Maintenance-support-to-pg_d.patch,
the constraint which is automatically created during "CREATE INCREMENTAL MATERIALIZED VIEW" is also dumped.
This cause error during recovery as follows.

ivm=# create table t (c1 int, c2 int);
CREATE TABLE
ivm=# create incremental materialized view ivm_t as select distinct c1 from t;
NOTICE: created index "ivm_t_index" on materialized view "ivm_t"
SELECT 0

Then I executed pg_dump.

In the dump, the following SQLs appear.

CREATE INCREMENTAL MATERIALIZED VIEW public.ivm_t AS
SELECT DISTINCT t.c1
FROM public.t
WITH NO DATA;

ALTER TABLE ONLY public.ivm_t
ADD CONSTRAINT ivm_t_index UNIQUE (c1);

If I execute psql with the result of pg_dump, following error occurs.

ERROR: ALTER action ADD CONSTRAINT cannot be performed on relation "ivm_t"
DETAIL: This operation is not supported for materialized views.

Regards,
Ryohei Takahashi

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2021-09-06 10:10:01 Re: Patch: shouldn't timezone(text, timestamp[tz]) be STABLE?
Previous Message Amit Kapila 2021-09-06 09:54:59 Re: Diagnostic comment in LogicalIncreaseXminForSlot