pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13814: missing command in psql autocompletion
2+ messages / 2 participants
[nested] [flat]

* BUG #13814: missing command in psql autocompletion
@ 2015-12-13 19:32  johannes@selfnet.de
  0 siblings, 1 reply; 2+ messages in thread

From: johannes@selfnet.de @ 2015-12-13 19:32 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      13814
Logged by:          Johannes
Email address:      johannes@selfnet.de
PostgreSQL version: 9.4.5
Operating system:   Debian/Arch
Description:        

Hi,

I'm pretty accustomed to the autocompletion feature of psql. Now, I found
that altering the tablespace of a materialized view is not included in the
autocompletion options:

db=> ALTER MATERIALIZED VIEW mvname <tab>

offers ALTER COLUMN, OWNER TO, RENAME TO and SET SCHEMA, but not SET as for
tables. When manually entered, the autocompletion options are the same as if
SET was entered as a command. 

Best
  Johannes


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #13814: missing command in psql autocompletion
@ 2015-12-14 05:42  Michael Paquier <michael.paquier@gmail.com>
  parent: johannes@selfnet.de
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2015-12-14 05:42 UTC (permalink / raw)
  To: johannes@selfnet.de; +Cc: pgsql-bugs

On Mon, Dec 14, 2015 at 4:32 AM,  <johannes@selfnet.de> wrote:
> I'm pretty accustomed to the autocompletion feature of psql. Now, I found
> that altering the tablespace of a materialized view is not included in the
> autocompletion options:
>
> db=> ALTER MATERIALIZED VIEW mvname <tab>
>
> offers ALTER COLUMN, OWNER TO, RENAME TO and SET SCHEMA, but not SET as for
> tables. When manually entered, the autocompletion options are the same as if
> SET was entered as a command.

Yeah, it would be more portable to hint first to SET, and then match
with the other keywords, like WITHOUT, TABLESPACE, SCHEMA, etc. And
actually ALTER MATVIEW SET does not hint correctly as well. See for
example the patch attached that improves a bit the situation. Note
that "SET (" does not hint to the list of parameters, we may want to
add some more stuff for the equivalent portion in ALTER TABLE SET, not
sure that's worth it...
-- 
Michael

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments:

20151214_psql_tab_alter_matview.patch (binary/octet-stream, 1.0K) download diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 8c48881..00b9f76 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -1454,10 +1454,22 @@ psql_completion(const char *text, int start, int end) pg_strcasecmp(prev2_wd, "VIEW") == 0) { static const char *const list_ALTERMATVIEW[] = - {"ALTER COLUMN", "OWNER TO", "RENAME TO", "SET SCHEMA", NULL}; + {"ALTER COLUMN", "CLUSTER ON", "OWNER TO", "RENAME TO", "RESET", + "SET", NULL}; COMPLETE_WITH_LIST(list_ALTERMATVIEW); } + /* ALTER MATERIALIZED VIEW <name> SET */ + else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 && + pg_strcasecmp(prev4_wd, "MATERIALIZED") == 0 && + pg_strcasecmp(prev3_wd, "VIEW") == 0 && + pg_strcasecmp(prev_wd, "SET") == 0) + { + static const char *const list_ALTERMATVIEWSET[] = + {"(", "SCHEMA", "TABLESPACE", "WITHOUT CLUSTER", NULL}; + + COMPLETE_WITH_LIST(list_ALTERMATVIEWSET); + } /* ALTER POLICY <name> */ else if (pg_strcasecmp(prev2_wd, "ALTER") == 0 &&
^ permalink raw reply [nested|flat] 2+ messages in thread


end of thread, other threads:[~2015-12-14 05:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-12-13 19:32 BUG #13814: missing command in psql autocompletion johannes@selfnet.de
2015-12-14 05:42 ` Michael Paquier <michael.paquier@gmail.com>

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