Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER
Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
From: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker )
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>, David Fetter <david@fetter.org>,
pgsql-hackers@postgresql.org
Date: 2018-10-25T16:02:32Z
Lists: pgsql-hackers
Attachments
Tom Lane <tgl@sss.pgh.pa.us> writes:
> 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.
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
Commits
-
Add tab completion of EXECUTE FUNCTION for CREATE TRIGGER in psql
- fdf5eade9626 11.1 landed
- 292ef6e2778a 12.0 landed
-
Improve tab completion of CREATE EVENT TRIGGER in psql
- 5953c9969762 12.0 landed
-
Improve tab completion for ANALYZE, EXPLAIN, and VACUUM.
- 121213d9d852 12.0 cited