Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER
Date
Msg-id 20181023234305.GE1658@paquier.xyz
Whole thread Raw
In response to [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER  (ilmari@ilmari.org (Dagfinn Ilmari Mannsåker))
Responses Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER  (David Fetter <david@fetter.org>)
List pgsql-hackers
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.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Log timestamps at higher resolution
Next
From: Michael Paquier
Date:
Subject: Re: Log timestamps at higher resolution