From: | Christoph Heiss <christoph(at)c8h4(dot)io> |
---|---|
To: | David Zhang <david(dot)zhang(at)highgo(dot)ca> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] psql: Add tab-complete for optional view parameters |
Date: | 2023-08-12 18:09:52 |
Message-ID: | nh2soocmoykquyswp5ez655h6xj7rtvfacx2vvh6iztggatwwu@bhsaph5ivbxq |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Aug 11, 2023 at 12:48:17PM -0700, David Zhang wrote:
>
> Applied v3 patch to master and verified it with below commands,
Thanks for testing!
> [..]
>
> For below changes,
>
> else if (TailMatches("CREATE", "VIEW", MatchAny, "AS") ||
> - TailMatches("CREATE", "OR", "REPLACE", "VIEW", MatchAny,
> "AS"))
> + TailMatches("CREATE", "VIEW", MatchAny, "WITH", "(*)", "AS")
> ||
> + TailMatches("CREATE", "OR", "REPLACE", "VIEW", MatchAny, "AS")
> ||
> + TailMatches("CREATE", "OR", "REPLACE", "VIEW", MatchAny,
> "WITH", "(*)", "AS"))
>
> it would be great to switch the order of the 3rd and the 4th line to make a
> better match for "CREATE" and "CREATE OR REPLACE" .
I don't see how it would effect matching in any way - or am I
overlooking something here?
postgres=# CREATE VIEW v <tab>
AS WITH (
postgres=# CREATE VIEW v AS <tab>
.. autocompletes with "SELECT"
postgres=# CREATE VIEW v WITH ( security_invoker = true ) <tab>
.. autocompletes with "AS" and so on
And the same for CREATE OR REPLACE VIEW.
Can you provide an example case that would benefit from that?
>
> Since it supports <tab> in the middle for below case,
> postgres=# alter view v set ( security_<tab>
> security_barrier security_invoker
>
> and during view reset it can also provide all the options list,
> postgres=# alter view v reset (
> CHECK_OPTION SECURITY_BARRIER SECURITY_INVOKER
>
> but not sure if it is a good idea or possible to autocomplete the reset
> options after seeing one of the options showing up with "," for example,
> postgres=# alter view v reset ( CHECK_OPTION, <tab>
> SECURITY_BARRIER SECURITY_INVOKER
I'd rather not add this and leave it as-is. It doesn't add any real
value - how often does this case really come up, especially with ALTER
VIEW only having three options?
Thanks,
Christoph
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2023-08-12 18:25:59 | Re: CREATE FUNCTION ... SEARCH { DEFAULT | SYSTEM | SESSION } |
Previous Message | Jeff Davis | 2023-08-12 16:23:31 | Re: CREATE FUNCTION ... SEARCH { DEFAULT | SYSTEM | SESSION } |