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

From Tom Lane
Subject Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER
Date
Msg-id 22598.1540467157@sss.pgh.pa.us
Whole thread Raw
In response to Re: [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  (ilmari@ilmari.org (Dagfinn Ilmari Mannsåker))
List pgsql-hackers
ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) writes:
> Tom Lane <tgl@sss.pgh.pa.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.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Christian Ullrich
Date:
Subject: Re: Problem with EDB 11.0 Windows x64 distributions
Next
From: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Date:
Subject: Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER