RE: Implementing Incremental View Maintenance

From: "r(dot)takahashi_2(at)fujitsu(dot)com" <r(dot)takahashi_2(at)fujitsu(dot)com>
To: 'Yugo NAGATA' <nagata(at)sraoss(dot)co(dot)jp>
Cc: 'Zhihong Yu' <zyu(at)yugabyte(dot)com>, 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-11-24 04:31:25
Message-ID: OS0PR01MB5682B499319EBEB59F416AD582619@OS0PR01MB5682.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Nagata-san,

> Ok. I'll fix _copyIntoClause() and _equalIntoClause() as well as _readIntoClause()
> and _outIntoClause().

OK.

> > 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.
>
> Good catch! It was my mistake creating unique constraints on IMMV in spite of
> we cannot defined them via SQL. I'll fix it to use unique indexes instead of
> constraints.

I checked the same procedure on v24 patch.
But following error occurs instead of the original error.

ERROR: relation "ivm_t_index" already exists

Regards,
Ryohei Takahashi

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-11-24 04:34:17 Re: parallel vacuum comments
Previous Message Amit Kapila 2021-11-24 04:28:06 Re: parallel vacuum comments