Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER

From: ilmari(at)ilmari(dot)org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=)
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, David Fetter <david(at)fetter(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER
Date: 2018-10-25 11:25:33
Message-ID: d8ja7n2p8sy.fsf@dalvik.ping.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Michael Paquier <michael(at)paquier(dot)xyz> writes:
>> On Wed, Oct 24, 2018 at 10:36:41AM +0100, Dagfinn Ilmari Mannsåker wrote:
>>> Fair point. I was unsure about whether to complete every supported
>>> variant or just the new one. Updated patches attached.
>
>> One problem with this approach is that a user needs to use twice tab.
>> The first time is to show "EXECUTE", and the second time is to show
>> automatically "PROCEDURE" or "FUNCTION" automatically.
>
> Yeah. Why don't we keep the existing behavior of completing both
> words at once, but make it server-version-dependent which completion
> you get?

I did that initially, but because COMPLETE_WITH() requres constant
arguments, I had to repeat the whole list with just changing PROCEDURE
to FUNCTION, which I thought was undesirably repetitive. If there's a
more concise alternative to the below, or the consensus is that saving
one TAB press is worth it, I'll change it.

else if (HeadMatches("CREATE", "TRIGGER") && TailMatches("ON", MatchAny))
if (pset.sversion >= 110000)
COMPLETE_WITH("NOT DEFERRABLE", "DEFERRABLE", "INITIALLY",
"REFERENCING", "FOR", "WHEN (", "EXECUTE FUNCTION");
else
COMPLETE_WITH("NOT DEFERRABLE", "DEFERRABLE", "INITIALLY",
"REFERENCING", "FOR", "WHEN (", "EXECUTE PROCEDURE");

- ilmari
--
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
the consequences of." -- Skud's Meta-Law

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christian Ullrich 2018-10-25 11:28:45 Re: Problem with EDB 11.0 Windows x64 distributions
Previous Message Dilip Kumar 2018-10-25 10:54:04 Re: CVE-2017-7484-induced bugs, or, btree cmp functions are not leakproof?