Re: Implementing Incremental View Maintenance

From: Takuma Hoshiai <hoshiai(at)sraoss(dot)co(dot)jp>
To: nuko yokohama <nuko(dot)yokohama(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, alvherre(at)2ndquadrant(dot)com, thomas(dot)munro(at)gmail(dot)com, kgrittn(at)gmail(dot)com, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Subject: Re: Implementing Incremental View Maintenance
Date: 2019-11-29 07:10:40
Message-ID: 20191129161040.4a7669eb85a78f1db1eb8ca4@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 29 Nov 2019 15:45:13 +0900
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:

> The following review on our patch was posted on another thread,
> so I quote here. The tab completion is Hoshiai-san's work, so
> he will handle this issue.
>
> Regards,
> Yugo Nagata.
>
> On Thu, 28 Nov 2019 13:00:05 +0900
> nuko yokohama <nuko(dot)yokohama(at)gmail(dot)com> wrote:
>
> > Hi.
> >
> > I'm using the "Incremental Materialized View Maintenance" patch and have
> > reported the following issues.
> > (https://commitfest.postgresql.org/25/2138/)
> >
> > To Suggest a "DROP INCREMENTAL MATERIALIZED VIEW" in psql, but the syntax
> > error when you run.
> > ("DROP MATERIALIZED VIEW" command can drop Incremental Materialozed view
> > normally.)

Thank you for your review. This psql's suggestion is mistake,
"INCREMENTAL MATERIALIZED" phrase is only used for CREATE statement.

I will fix it as the following:

diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 2051bc3..8c4b211 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1001,7 +1001,7 @@ static const pgsql_thing_t words_after_create[] = {
{"FOREIGN TABLE", NULL, NULL, NULL},
{"FUNCTION", NULL, NULL, Query_for_list_of_functions},
{"GROUP", Query_for_list_of_roles},
- {"INCREMENTAL MATERIALIZED VIEW", NULL, NULL, &Query_for_list_of_matviews},
+ {"INCREMENTAL MATERIALIZED VIEW", NULL, NULL, &Query_for_list_of_matviews, THING_NO_DROP | THING_NO_ALTER},
{"INDEX", NULL, NULL, &Query_for_list_of_indexes},
{"LANGUAGE", Query_for_list_of_languages},
{"LARGE OBJECT", NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},

Best Regards,
Takuma Hoshiai

> > ramendb=# CREATE INCREMENTAL MATERIALIZED VIEW pref_count AS SELECT pref,
> > COUNT(pref) FROM shops GROUP BY pref;
> > SELECT 48
> > ramendb=# \d pref_count
> > Materialized view "public.pref_count"
> > Column | Type | Collation | Nullable | Default
> > ---------------+--------+-----------+----------+---------
> > pref | text | | |
> > count | bigint | | |
> > __ivm_count__ | bigint | | |
> >
> > ramendb=# DROP IN
> > INCREMENTAL MATERIALIZED VIEW INDEX
> > ramendb=# DROP INCREMENTAL MATERIALIZED VIEW pref_count;
> > 2019-11-27 11:51:03.916 UTC [9759] ERROR: syntax error at or near
> > "INCREMENTAL" at character 6
> > 2019-11-27 11:51:03.916 UTC [9759] STATEMENT: DROP INCREMENTAL
> > MATERIALIZED VIEW pref_count;
> > ERROR: syntax error at or near "INCREMENTAL"
> > LINE 1: DROP INCREMENTAL MATERIALIZED VIEW pref_count;
> > ^
> > ramendb=# DROP MATERIALIZED VIEW pref_count ;
> > DROP MATERIALIZED VIEW
> > ramendb=#
> >
> >
> > Regard.
>
>
> --
> Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
>
>
> --
> Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
>

--
Takuma Hoshiai <hoshiai(at)sraoss(dot)co(dot)jp>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-11-29 07:36:00 Update minimum SSL version
Previous Message Michael Paquier 2019-11-29 06:51:15 Increase footprint of %m and reduce strerror()