Re: CREATE MATERIALIZED VIEW

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>

From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: px shi <spxlyy123@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2024-07-25T13:56:07Z
Lists: pgsql-hackers

Attachments

px shi <spxlyy123@gmail.com> writes:

> Hi, I see that materialized view cannot be unlogged now, but when I use
> psql and type CREATE UNLOGGED, pressing the Tab key for auto-completion
> suggests `TABLE` and MATERIALIZED VIEW.
> Shouldn't `MATERIALIZED VIEW ` be suggested?

That's my fault, I added it in commit c951e9042dd1, presumably because
the grammar allows it, but it turns transformCreateTableAsStmt() rejects
it.

Attached is a patch to fix it, which sholud be backpatched to v17.

- ilmari

Commits

  1. Remove tab completion for CREATE UNLOGGED MATERIALIZED VIEW.

  2. Add tab completion for CREATE SCHEMA in psql

  3. Disallow unlogged materialized views.

  4. Add a materialized view relations.