public inbox for [email protected]
help / color / mirror / Atom feedFrom: Michael Paquier <[email protected]>
To: Nathan Bossart <[email protected]>
Cc: Shinya Kato <[email protected]>
Cc: David G. Johnston <[email protected]>
Cc: Postgres hackers <[email protected]>
Subject: Re: Partitioned tables and [un]loggedness
Date: Thu, 5 Jun 2025 09:23:42 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <aEBxIcAiiDVlQvdx@nathan>
References: <[email protected]>
<[email protected]>
<ZurvG45F3lQHLw4G@nathan>
<Zur4qqhABOXtZS8h@nathan>
<[email protected]>
<[email protected]>
<[email protected]>
<CAOzEurQZ1a+6d1K8b=+Ww1NFQVwAt9KSCQsBWXYBaPnYCenK3g@mail.gmail.com>
<CAOzEurRRfPaZn_ZGmoDz2C3+74SAhk+FUZo_9oB1Zg_rQNGkYA@mail.gmail.com>
<aEBxIcAiiDVlQvdx@nathan>
On Wed, Jun 04, 2025 at 11:15:29AM -0500, Nathan Bossart wrote:
> I see no benefit in recommending things that are guaranteed to error. In
> commit 5c1ce1b, we removed tab completion for CREATE UNLOGGED MATERIALIZED
> VIEW even though it is supported by the grammar. The partitioned table
> case sounds like roughly the same situation.
Agreed to not suggest the PARTITION BY clause in the tab completion as
it is not supported by the backend for unlogged tables.
tab-complete.in.c has some handling for CREATE UNLOGGED TABLE around
line 3667, so we could just have an extra case for it, like in the
attached patch. A split already exists for temporary tables to handle
the ON COMMIT clause after the attribute list.
Thoughts?
--
Michael
Attachments:
[text/x-diff] psql-tab-unlogged.patch (1.0K, ../[email protected]/2-psql-tab-unlogged.patch)
download | inline diff:
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index ec65ab79fecb..620830feb9d7 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -3664,9 +3664,10 @@ match_previous_words(int pattern_id,
TailMatches("CREATE", "TEMP|TEMPORARY|UNLOGGED", "TABLE", MatchAny, "(*)", "AS"))
COMPLETE_WITH("EXECUTE", "SELECT", "TABLE", "VALUES", "WITH");
/* Complete CREATE TABLE name (...) with supported options */
- else if (TailMatches("CREATE", "TABLE", MatchAny, "(*)") ||
- TailMatches("CREATE", "UNLOGGED", "TABLE", MatchAny, "(*)"))
+ else if (TailMatches("CREATE", "TABLE", MatchAny, "(*)"))
COMPLETE_WITH("AS", "INHERITS (", "PARTITION BY", "USING", "TABLESPACE", "WITH (");
+ else if (TailMatches("CREATE", "UNLOGGED", "TABLE", MatchAny, "(*)"))
+ COMPLETE_WITH("AS", "INHERITS (", "USING", "TABLESPACE", "WITH (");
else if (TailMatches("CREATE", "TEMP|TEMPORARY", "TABLE", MatchAny, "(*)"))
COMPLETE_WITH("AS", "INHERITS (", "ON COMMIT", "PARTITION BY", "USING",
"TABLESPACE", "WITH (");
[application/pgp-signature] signature.asc (833B, ../[email protected]/3-signature.asc)
download
view thread (20+ messages) latest in thread
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], [email protected], [email protected], [email protected]
Subject: Re: Partitioned tables and [un]loggedness
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