Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
927d7bb6
Commit
927d7bb6
authored
Nov 04, 2016
by
Kevin Grittner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve tab completion for CREATE TRIGGER.
This includes support for the new REFERENCING clause.
parent
8c48375e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
src/bin/psql/tab-complete.c
src/bin/psql/tab-complete.c
+34
-0
No files found.
src/bin/psql/tab-complete.c
View file @
927d7bb6
...
@@ -2209,9 +2209,43 @@ psql_completion(const char *text, int start, int end)
...
@@ -2209,9 +2209,43 @@ psql_completion(const char *text, int start, int end)
/* complete CREATE TRIGGER ... INSTEAD OF event ON with a list of views */
/* complete CREATE TRIGGER ... INSTEAD OF event ON with a list of views */
else
if
(
TailMatches7
(
"CREATE"
,
"TRIGGER"
,
MatchAny
,
"INSTEAD"
,
"OF"
,
MatchAny
,
"ON"
))
else
if
(
TailMatches7
(
"CREATE"
,
"TRIGGER"
,
MatchAny
,
"INSTEAD"
,
"OF"
,
MatchAny
,
"ON"
))
COMPLETE_WITH_SCHEMA_QUERY
(
Query_for_list_of_views
,
NULL
);
COMPLETE_WITH_SCHEMA_QUERY
(
Query_for_list_of_views
,
NULL
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
TailMatches2
(
"ON"
,
MatchAny
))
COMPLETE_WITH_LIST7
(
"NOT DEFERRABLE"
,
"DEFERRABLE"
,
"INITIALLY"
,
"REFERENCING"
,
"FOR"
,
"WHEN ("
,
"EXECUTE PROCEDURE"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
(
TailMatches1
(
"DEFERRABLE"
)
||
TailMatches2
(
"INITIALLY"
,
"IMMEDIATE|DEFERRED"
)))
COMPLETE_WITH_LIST4
(
"REFERENCING"
,
"FOR"
,
"WHEN ("
,
"EXECUTE PROCEDURE"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
TailMatches1
(
"REFERENCING"
))
COMPLETE_WITH_LIST2
(
"OLD TABLE"
,
"NEW TABLE"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
TailMatches2
(
"OLD|NEW"
,
"TABLE"
))
COMPLETE_WITH_CONST
(
"AS"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
(
TailMatches5
(
"REFERENCING"
,
"OLD"
,
"TABLE"
,
"AS"
,
MatchAny
)
||
TailMatches4
(
"REFERENCING"
,
"OLD"
,
"TABLE"
,
MatchAny
)))
COMPLETE_WITH_LIST4
(
"NEW TABLE"
,
"FOR"
,
"WHEN ("
,
"EXECUTE PROCEDURE"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
(
TailMatches5
(
"REFERENCING"
,
"NEW"
,
"TABLE"
,
"AS"
,
MatchAny
)
||
TailMatches4
(
"REFERENCING"
,
"NEW"
,
"TABLE"
,
MatchAny
)))
COMPLETE_WITH_LIST4
(
"OLD TABLE"
,
"FOR"
,
"WHEN ("
,
"EXECUTE PROCEDURE"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
(
TailMatches9
(
"REFERENCING"
,
"OLD|NEW"
,
"TABLE"
,
"AS"
,
MatchAny
,
"OLD|NEW"
,
"TABLE"
,
"AS"
,
MatchAny
)
||
TailMatches8
(
"REFERENCING"
,
"OLD|NEW"
,
"TABLE"
,
MatchAny
,
"OLD|NEW"
,
"TABLE"
,
"AS"
,
MatchAny
)
||
TailMatches8
(
"REFERENCING"
,
"OLD|NEW"
,
"TABLE"
,
"AS"
,
MatchAny
,
"OLD|NEW"
,
"TABLE"
,
MatchAny
)
||
TailMatches7
(
"REFERENCING"
,
"OLD|NEW"
,
"TABLE"
,
MatchAny
,
"OLD|NEW"
,
"TABLE"
,
MatchAny
)))
COMPLETE_WITH_LIST3
(
"FOR"
,
"WHEN ("
,
"EXECUTE PROCEDURE"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
TailMatches1
(
"FOR"
))
COMPLETE_WITH_LIST3
(
"EACH"
,
"ROW"
,
"STATEMENT"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
TailMatches2
(
"FOR"
,
"EACH"
))
COMPLETE_WITH_LIST2
(
"ROW"
,
"STATEMENT"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
(
TailMatches3
(
"FOR"
,
"EACH"
,
"ROW|STATEMENT"
)
||
TailMatches2
(
"FOR"
,
"ROW|STATEMENT"
)))
COMPLETE_WITH_LIST2
(
"WHEN ("
,
"EXECUTE PROCEDURE"
);
/* complete CREATE TRIGGER ... EXECUTE with PROCEDURE */
/* complete CREATE TRIGGER ... EXECUTE with PROCEDURE */
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
TailMatches1
(
"EXECUTE"
))
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
TailMatches1
(
"EXECUTE"
))
COMPLETE_WITH_CONST
(
"PROCEDURE"
);
COMPLETE_WITH_CONST
(
"PROCEDURE"
);
else
if
(
HeadMatches2
(
"CREATE"
,
"TRIGGER"
)
&&
TailMatches2
(
"EXECUTE"
,
"PROCEDURE"
))
COMPLETE_WITH_SCHEMA_QUERY
(
Query_for_list_of_functions
,
NULL
);
/* CREATE ROLE,USER,GROUP <name> */
/* CREATE ROLE,USER,GROUP <name> */
else
if
(
Matches3
(
"CREATE"
,
"ROLE|GROUP|USER"
,
MatchAny
)
&&
else
if
(
Matches3
(
"CREATE"
,
"ROLE|GROUP|USER"
,
MatchAny
)
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment