public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dagfinn Ilmari Mannsåker <[email protected]>
To: px shi <[email protected]>
Cc: [email protected]
Subject: Re: CREATE MATERIALIZED VIEW
Date: Thu, 25 Jul 2024 14:56:07 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAAccyY+Wg1Z-9tNfSwLmuZVgGOwqU5u1OP-RWcoAr2UZGuvN_w@mail.gmail.com>
References: <CAAccyY+Wg1Z-9tNfSwLmuZVgGOwqU5u1OP-RWcoAr2UZGuvN_w@mail.gmail.com>
px shi <[email protected]> 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
Attachments:
[text/x-diff] 0001-Don-t-tab-complete-MATERIALIZED-VIEW-after-CREATE-UN.patch (1.5K, ../[email protected]/2-0001-Don-t-tab-complete-MATERIALIZED-VIEW-after-CREATE-UN.patch)
download | inline diff:
From f8bc4d760aadd5f1f3d805f6de7c0d6d3eb8d078 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <[email protected]>
Date: Thu, 25 Jul 2024 14:33:14 +0100
Subject: [PATCH] Don't tab complete MATERIALIZED VIEW after CREATE UNLOGGED
This was erroneously added in commit c951e9042dd1 because the grammar
allows it, but it turns out transformCreateTableAsStmt() rejects it.
---
src/bin/psql/tab-complete.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 891face1b6..024469474d 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3267,15 +3267,9 @@ psql_completion(const char *text, int start, int end)
/* Complete "CREATE TEMP/TEMPORARY" with the possible temp objects */
else if (TailMatches("CREATE", "TEMP|TEMPORARY"))
COMPLETE_WITH("SEQUENCE", "TABLE", "VIEW");
- /* Complete "CREATE UNLOGGED" with TABLE, SEQUENCE or MATVIEW */
+ /* Complete "CREATE UNLOGGED" with TABLE or SEQUENCE */
else if (TailMatches("CREATE", "UNLOGGED"))
- {
- /* but not MATVIEW in CREATE SCHEMA */
- if (HeadMatches("CREATE", "SCHEMA"))
- COMPLETE_WITH("TABLE", "SEQUENCE");
- else
- COMPLETE_WITH("TABLE", "SEQUENCE", "MATERIALIZED VIEW");
- }
+ COMPLETE_WITH("TABLE", "SEQUENCE");
/* Complete PARTITION BY with RANGE ( or LIST ( or ... */
else if (TailMatches("PARTITION", "BY"))
COMPLETE_WITH("RANGE (", "LIST (", "HASH (");
--
2.39.2
view thread (3+ messages)
reply
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: [email protected]
Cc: [email protected], [email protected]
Subject: Re: CREATE MATERIALIZED VIEW
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox