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 16:02:32
Message-ID: d8jwoq6nhev.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:

> ilmari(at)ilmari(dot)org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) writes:
>> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>>> 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_WITHc() 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");
>
> Well, that's not beautiful, but there aren't so many alternatives
> that it's really unmaintainable. I think it's probably better than
> requiring an additional TAB-press.

Okay, revised patches attached. I also tweaked the CREATE EVENT TRIGGER
completion to accept multple <filter_varaible> IN (<filter_value>)
conditions seprated by AND in the WHEN clause (but not to suggest that,
since we only actually support one <filter_variable>, TAG).

- ilmari
--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen

Attachment Content-Type Size
v2-0001-Tab-complete-EXECUTE-FUNCTION-for-CREATE-TRIGGER.patch text/x-diff 5.2 KB
v2-0002-Improve-CREATE-EVENT-TRIGGER-tab-completion.patch text/x-diff 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2018-10-25 16:04:22 Re: Log timestamps at higher resolution
Previous Message Krzysztof Nienartowicz 2018-10-25 15:58:13 Re: Speeding up INSERTs and UPDATEs to partitioned tables