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: David Fetter <david(at)fetter(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER
Date: 2018-10-24 09:36:41
Message-ID: d8jefcfptxy.fsf@dalvik.ping.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter <david(at)fetter(dot)org> writes:

> On Wed, Oct 24, 2018 at 08:43:05AM +0900, Michael Paquier wrote:
>> On Tue, Oct 23, 2018 at 12:26:35PM +0100, Dagfinn Ilmari Mannsåker wrote:
>> > The last-minute change for CREATE (EVENT) TRIGGER to accept EXECUTE
>> > FUNCTION as well as EXECUTE PROCEDURE did not update the tab completion
>> > in psql to match. Please find attached two patches that do this for
>> > CREATE TRIGGER and CREATE EVENT TRIGGER, respectively.
>>
>> Yes, it would be nice to fix that.
>>
>> > To keep the duplication minimal, I've changed it from completing EXECUTE
>> > PROCEDURE as a single thing to just EXECUTE, and then completing
>> > FUNCTION or FUNCTION and PROCEDURE after that depending on the server
>> > version.
>>
>> + else if (HeadMatches("CREATE", "EVENT", "TRIGGER") && TailMatches("EXECUTE"))
>> + if (pset.sversion >= 110000)
>> + COMPLETE_WITH("FUNCTION", "PROCEDURE");
>> + else
>> + COMPLETE_WITH("PROCEDURE");
>>
>> PROCEDURE is documented as deprecated as of v11 for CREATE TRIGGER
>> and CREATE EVENT TRIGGER. Wouldn't it be better to just complete
>> with FUNCTION for a v11 or newer server? I think that we want to
>> encourage users to use EXECUTE FUNCTION if possible.
>
> +1 for not completing with syntax we've just deprecated.

Fair point. I was unsure about whether to complete every supported
variant or just the new one. Updated patches attached.

- ilmari
--
"I use RMS as a guide in the same way that a boat captain would use
a lighthouse. It's good to know where it is, but you generally
don't want to find yourself in the same spot." - Tollef Fog Heen

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matsumura, Ryo 2018-10-24 09:43:31 RE: [PROPOSAL]a new data type 'bytea' for ECPG
Previous Message Tom Lane 2018-10-24 09:21:11 Re: Should pg 11 use a lot more memory building an spgist index?