Skip site navigation (1) Skip section navigation (2)

Re: psql tab-completion for new syntax

From: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql tab-completion for new syntax
Date: 2010-02-16 05:24:41
Message-ID: 20100216142440.9D88.52131E4D@oss.ntt.co.jp (view raw or flat)
Thread:
Lists: pgsql-hackers
Here is a patch to support new syntax in psql tab completion
and fix bugs to complete after an open parenthesis.

Supported additonal syntax are:
  - ALTER TABLE/INDEX/TABLESPACE SET/RESET with options
  - ALTER TABLE ALTER COLUMN SET/RESET with options
  - ALTER TABLE ALTER COLUMN SET STORAGE
  - CREATE TRIGGER with events
  - CREATE INDEX CONCURRENTLY
  - CREATE INDEX ON (without name)
  - CREATE INDEX ... USING with pg_am.amname instead of hard-corded names.

Fixes bugs are:
  Bug 1: Double parenthesis
    =# INSERT INTO pgbench_history VALUES (<TAB>
    =# INSERT INTO pgbench_history VALUES ((      <= wrong

  Bug 2: We cannot complete words if no whitespaces around a parenthesis.
    =# CREATE INDEX idx ON pgbench_history( <TAB>
                                          ^ no whitespace here

  Bug 3: should be completed with "(" before columns.
    =# CREATE INDEX foo ON pgbench_accounts USING BTREE <TAB>
    abalance  aid       bid       filler    <= wrong, should be "("

I adjusted previous_word() to split words not only with spaces but also
with non-alphabets, and removed a hack with find_open_parenthesis().

Comments?

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center


Attachment: psql-tab-completion_20100216.patch
Description: application/octet-stream (22.0 KB)

In response to

pgsql-hackers by date

Next:From: Jakub OuhrabkaDate: 2010-02-16 07:15:33
Subject: Problem with 8.4 stats collector high load
Previous:From: Tom LaneDate: 2010-02-16 05:20:21
Subject: Re: LISTEN/NOTIFY and notification timing guarantees

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group