pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Artur Zakirov <a.zakirov@postgrespro.ru>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
To: pgsql-hackers@postgresql.org
Subject: Re: IF (NOT) EXISTS in psql-completion
Date: Mon, 15 Feb 2016 15:43:57 +0300
Message-ID: <56C1C80D.7020101@postgrespro.ru> (raw)
In-Reply-To: <20160205.170901.60679714.horiguchi.kyotaro@lab.ntt.co.jp>
References: <20160205.170901.60679714.horiguchi.kyotaro@lab.ntt.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 05.02.2016 11:09, Kyotaro HORIGUCHI wrote:
> Hello,
>
> I considered how to make tab-completion robust for syntactical
> noises, in other words, optional words in syntax. Typically "IF
> (NOT) EXISTS", UNIQUE and TEMPORARY are words that don't affect
> further completion. However, the current delimit-matching
> mechanism is not so capable (or is complexty-prone) to live with
> such noises. I have proposed to use regular expressions or
> simplified one for the robustness but it was too complex to be
> applied.
>
> This is another answer for the problem. Removal of such words
> on-the-fly makes further matching more robust.
>
> Next, currently some CREATE xxx subsyntaxes of CREATE SCHEMA are
> matched using TailMatching but it makes difficult the
> options-removal operations, which needs forward matching.
>
> So I introduced two things to resolve them by this patch.
>

I did some tests with your patch. But I am not confident in tab-complete.c.

And I have some notes:

1 - I execute git apply command and get the following warning:

../0001-Suggest-IF-NOT-EXISTS-for-tab-completion-of-psql.patch:302: 
trailing whitespace.
	/*
warning: 1 line adds whitespace errors.

This is because of superfluous whitespace I think.

2 - In psql I write "create table if" and press <TAB>. psql adds the 
following:

create table IF NOT EXISTS

I think psql should continue with lower case if user wrote query with 
loser case text:

create table if not exists

3 - Same with "IF EXISTS". If a write "alter view if" and press <TAB> 
psql writes:

alter view IF EXISTS

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


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



view thread (90+ messages)  latest in thread

Message-ID: <56C1C80D.7020101@postgrespro.ru>
Permalink:  ../56C1C80D.7020101@postgrespro.ru/
Also on:    postgresql.org/message-id/56C1C80D.7020101@postgrespro.ru

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: pgsql-hackers@postgresql.org
  Cc: a.zakirov@postgrespro.ru, horiguchi.kyotaro@lab.ntt.co.jp
  Subject: Re: IF (NOT) EXISTS in psql-completion
  In-Reply-To: <56C1C80D.7020101@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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