pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: btnakamichin <btnakamichin@oss.nttdata.com>
To: pgsql-hackers@postgresql.org
Subject: Feature improvement for FETCH tab completion
Date: Fri, 25 Sep 2020 14:24:30 +0900
Message-ID: <d05a46b599634ca0d94144387507f4b4@oss.nttdata.com> (raw)

Hello!

I’d like to improve the FETCH tab completion.

The FETCH tab completion . Therefore, this patch fixes the problem.

Previous function completed one of FORWARD, BACKWARD, RELATIVE, 
ABSOLUTE, but now it completes one of FORWARD, BACKWARD, RELATIVE, 
ABSOLUTE, ALL, NEXT, PRIOR, FIRST, LAST and Corresponded to later IN and 
FROM clauses.

Regards,

Naoki Nakamichi

Attachments:

fix_tab_complete_fetch.patch (text/x-diff, 1.5K) download diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index d877cc86f0..eb103b784e 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3076,19 +3076,22 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH("SELECT", "INSERT", "DELETE", "UPDATE", "DECLARE"); /* FETCH && MOVE */ - /* Complete FETCH with one of FORWARD, BACKWARD, RELATIVE */ + /* Complete FETCH with one of FORWARD, BACKWARD, RELATIVE, ALL, NEXT, PRIOR, FIRST, LAST */ else if (Matches("FETCH|MOVE")) - COMPLETE_WITH("ABSOLUTE", "BACKWARD", "FORWARD", "RELATIVE"); - /* Complete FETCH <sth> with one of ALL, NEXT, PRIOR */ - else if (Matches("FETCH|MOVE", MatchAny)) - COMPLETE_WITH("ALL", "NEXT", "PRIOR"); + COMPLETE_WITH("ABSOLUTE", "BACKWARD", "FORWARD", "RELATIVE", "ALL", "NEXT", "PRIOR", "FIRST", "LAST"); + /* Complete FETCH BACKWARD or FORWARD with one of ALL */ + else if (Matches("FETCH|MOVE", "BACKWARD|FORWARD")) + COMPLETE_WITH("ALL"); /* - * Complete FETCH <sth1> <sth2> with "FROM" or "IN". These are equivalent, + * Complete FETCH <direction> with "FROM" or "IN". These are equivalent, * but we may as well tab-complete both: perhaps some users prefer one * variant or the other. */ - else if (Matches("FETCH|MOVE", MatchAny, MatchAny)) + else if (Matches("FETCH|MOVE", "ABSOLUTE|BACKWARD|FORWARD|RELATIVE", MatchAny)) + COMPLETE_WITH("FROM", "IN"); + + else if (Matches("FETCH|MOVE", "ALL|NEXT|PRIOR|FIRST|LAST")) COMPLETE_WITH("FROM", "IN"); /* FOREIGN DATA WRAPPER */

view thread (5+ messages)  latest in thread

Message-ID: <d05a46b599634ca0d94144387507f4b4@oss.nttdata.com>
Permalink:  ../d05a46b599634ca0d94144387507f4b4@oss.nttdata.com/
Also on:    postgresql.org/message-id/d05a46b599634ca0d94144387507f4b4@oss.nttdata.com

 ·  · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: btnakamichin@oss.nttdata.com
  Subject: Re: Feature improvement for FETCH tab completion
  In-Reply-To: <d05a46b599634ca0d94144387507f4b4@oss.nttdata.com>
  References: <d05a46b599634ca0d94144387507f4b4@oss.nttdata.com>

* 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