Re: adding tab completions

Artur Zakirov <a.zakirov@postgrespro.ru>

From: Arthur Zakirov <a.zakirov@postgrespro.ru>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Edmund Horner <ejrh00@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2018-06-11T20:35:51Z
Lists: pgsql-hackers
On Sat, Jun 09, 2018 at 06:42:12PM -0500, Justin Pryzby wrote:
> > Moreover there is no such completion for example for the command (it shows
> > only first column):
> > 
> > CREATE INDEX ON test (
> 
> Noted (I misunderstood at first: you just mean there's precedent that column
> names aren't completed, except maybe the first).

Yes, exactly. It was about the precedent.

> I can revise patch to not complete attributes in analyze; but, I think that
> means that this will have to complete to table names:
> 
> 	postgres=# ANALYZE tt (a , 
> 	alu_enodeb_201601     information_schema.
> 	alu_enodeb_201602     jrn_pg_buffercache
> 	...
> 
> .. since, without checking for matching parens, it has no idea whether to
> complete with rels or atts.  WDYT?

IMHO, I'd leave the code as simple as possible. It is up to you of
course. But it is easy to add completion for a first attribute, by
adding the condition (and leave other attributes without completion):

else if (HeadMatches1("VACUUM") && TailMatches1("("))
    COMPLETE_WITH_ATTR(prev2_wd, "");

> > > -			"SERVER", "INDEX", "LANGUAGE", "POLICY", "PUBLICATION", "RULE",
> > > +			"SERVER", "INDEX", "LANGUAGE", "POLICY", "PUBLICATION",
> > 
> > Is this a typo? I think still there is a possibility to comment rules.
> 
> Not in PG11(b1) (note, that's a custom table)
> 	postgres=# COMMENT ON RULE pg_settings_u IS 'asdf';
> 	ERROR:  syntax error at or near "IS"
> ...
> Remove deprecated COMMENT ON RULE syntax
> e8d016d81940e75c126aa52971b7903b7301002e

Oh, I understood what it is it here. Those commit removed the syntax:

COMMENT ON RULE rule_name

But still there is the syntax:

COMMENT ON RULE rule_name ON table_name

I can run the command:

COMMENT ON RULE rtest ON test IS 'rtest';

> > The last point I've noticed, there is no VERBOSE entry after VACUUM FULL
> > ANALYZE command anymore.
> 
> See commit 921059bd6, above (it's not 100% clear to me that's intended to
> reject VACUUM ANALYZE VERBOSE and not just reject VACUUM VERBOSE ANALYZE
> VERBOSE, but I tentatively assume it's intentional).

Right. Understood.

> > I'm not sure how this patch should be commited. Can it be commited
> > outside the commitfest? Otherwise add it to the next commitfest please
> > in order not to forget it.
> 
> I've done https://commitfest.postgresql.org/18/1661/

Thank you!

-- 
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


Commits

  1. Improve tab completion for ANALYZE, EXPLAIN, and VACUUM.

  2. Minor fixes for psql tab completion.

  3. Add parenthesized options syntax for ANALYZE.

  4. Don't allow VACUUM VERBOSE ANALYZE VERBOSE.

  5. Parameter toast_tuple_target controls TOAST for new rows

  6. Add hash partitioning.

  7. Allow multiple tables to be specified in one VACUUM or ANALYZE command.

  8. Don't uselessly rewrite, truncate, VACUUM, or ANALYZE partitioned tables.

  9. Remove deprecated COMMENT ON RULE syntax

  10. Add VACUUM (DISABLE_PAGE_SKIPPING) for emergencies.

  11. Extend EXPLAIN to allow generic options to be specified.