Re: CREATE OR REPLACE MATERIALIZED VIEW

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Erik Wienhold <ewie(at)ewie(dot)name>
Subject: Re: CREATE OR REPLACE MATERIALIZED VIEW
Date: 2024-10-31 03:48:21
Message-ID: ZyL-BexBTGJ6Nkat@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 02, 2024 at 01:46:21PM +0300, Aleksander Alekseev wrote:
> I can imagine how this may impact many applications and upset many
> software developers worldwide. Was there even a precedent (in the
> recent decade or so) when PostgreSQL broke the SQL syntax?

We're usually very careful about that, and maintaining a
backward-compatible grammar has a minimal cost in the parser. The
closest thing I can think of that has a rather complicated grammar is
COPY, which has *two* legacy grammars still supported, one for ~7.3
and one for ~9.0.

> To clarify, I'm not opposed to this idea. If we are fine with breaking
> backward compatibility on the SQL level, this would allow dropping the
> support of inherited tables some day, a feature that in my humble
> opinion shouldn't exist (I realize this is another and very debatable
> question though). I just don't think this is something we ever do in
> this project. But I admit that this information may be incorrect
> and/or outdated.

I am not sure that there is much to gain with this proposal knowing
that the commands with matviews have been around for quite a long time
now. Particularly, after looking at 0001, you'd see that it shortcuts
a couple of areas of the CTAS code because that's what we are relying
on when building the initial data of matviews. Hence,
implementation-wise in the backend, matviews are much closer to
physical relations than views. This is trying to make matviews behave
more consistently with views.

This topic has been mentioned once on pgsql-general back in 2019, for
reference:
https://www.postgresql.org/message-id/CAAWhf%3DPHch2H3ekYnbafuwqWqwyRok8WVPaDxKosZE4GQ2pq5w%40mail.gmail.com
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jingtang Zhang 2024-10-31 04:17:14 Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM
Previous Message Peter Smith 2024-10-31 02:38:58 Re: Pgoutput not capturing the generated columns