Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5953c99

Browse files
committed
Improve tab completion of CREATE EVENT TRIGGER in psql
This adds tab completion of the clauses WHEN and EXECUTEFUNCTION|PROCEDURE clauses to CREATE EVENT TRIGGER, similar to CREATETRIGGER in the previous commit. This has version-dependent logic so asFUNCTION is chosen over PROCEDURE for 11 and newer versions.Author: Dagfinn Ilmari MannsåkerReviewed-by: Tom Lane, Michael PaquierDiscussion:https://postgr.es/m/d8jmur4q4yc.fsf@dalvik.ping.uio.no
1 parent292ef6e commit5953c99

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎src/bin/psql/tab-complete.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,6 +2608,29 @@ psql_completion(const char *text, int start, int end)
26082608
/* Complete CREATE EVENT TRIGGER <name> ON with event_type */
26092609
elseif (Matches("CREATE","EVENT","TRIGGER",MatchAny,"ON"))
26102610
COMPLETE_WITH("ddl_command_start","ddl_command_end","sql_drop");
2611+
/*
2612+
* Complete CREATE EVENT TRIGGER <name> ON <event_type>. EXECUTE FUNCTION
2613+
* is the recommended grammar instead of EXECUTE PROCEDURE in version 11
2614+
* and upwards.
2615+
*/
2616+
elseif (Matches("CREATE","EVENT","TRIGGER",MatchAny,"ON",MatchAny))
2617+
{
2618+
if (pset.sversion >=110000)
2619+
COMPLETE_WITH("WHEN TAG IN (","EXECUTE FUNCTION");
2620+
else
2621+
COMPLETE_WITH("WHEN TAG IN (","EXECUTE PROCEDURE");
2622+
}
2623+
elseif (HeadMatches("CREATE","EVENT","TRIGGER")&&
2624+
TailMatches("WHEN|AND",MatchAny,"IN","(*)"))
2625+
{
2626+
if (pset.sversion >=110000)
2627+
COMPLETE_WITH("EXECUTE FUNCTION");
2628+
else
2629+
COMPLETE_WITH("EXECUTE PROCEDURE");
2630+
}
2631+
elseif (HeadMatches("CREATE","EVENT","TRIGGER")&&
2632+
TailMatches("EXECUTE","FUNCTION|PROCEDURE"))
2633+
COMPLETE_WITH_VERSIONED_SCHEMA_QUERY(Query_for_list_of_functions,NULL);
26112634

26122635
/* DEALLOCATE */
26132636
elseif (Matches("DEALLOCATE"))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp