From: Said Assemlal <sassemlal@neurorx.com>
To: Erik Wienhold <ewie@ewie.name>
To: pgsql-hackers@postgresql.org
Subject: Re: CREATE OR REPLACE MATERIALIZED VIEW
Date: Thu, 4 Jul 2024 16:18:11 -0400
Message-ID: <d9db9bdb-593d-4cef-9274-0db640fcff42@neurorx.com> (raw)
In-Reply-To: <3c86a16f-4272-4df3-9959-70a9a7d88a71@ewie.name>
References: <3c86a16f-4272-4df3-9959-70a9a7d88a71@ewie.name>
Hi,
+1 for this feature.
> Replacing Matviews
> ------------------
>
> With patch 0001, a matview can be replaced without having to drop it and
> its dependent objects. In our use case it is no longer necessary to
> define the actual query in a separate view. Replacing a matview works
> analogous to CREATE OR REPLACE VIEW:
>
> * the new query may change SELECT list expressions of existing columns
> * new columns can be added to the end of the SELECT list
> * existing columns cannot be renamed
> * the data type of existing columns cannot be changed
>
> In addition to that, CREATE OR REPLACE MATERIALIZED VIEW also replaces
> access method, tablespace, and storage parameters if specified. The
> clause WITH [NO] DATA works as expected: it either populates the matview
> or leaves it in an unscannable state.
>
> It is an error to specify both OR REPLACE and IF NOT EXISTS.
I noticed replacing the materialized view is blocking all reads. Is that
expected ? Even if there is a unique index ?
Best,
Sa_ïd_
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: sassemlal@neurorx.com, ewie@ewie.name
Subject: Re: CREATE OR REPLACE MATERIALIZED VIEW
In-Reply-To: <d9db9bdb-593d-4cef-9274-0db640fcff42@neurorx.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox