File tree 4 files changed +29
-0
lines changed 4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -1144,6 +1144,10 @@ pub enum Statement {
1144
1144
///
1145
1145
/// Note: this is a MySQL-specific statement.
1146
1146
SetNamesDefault { } ,
1147
+ /// SHOW FUNCTIONS
1148
+ ///
1149
+ /// Note: this is a Presto-specific statement.
1150
+ ShowFunctions { filter : Option < ShowStatementFilter > } ,
1147
1151
/// SHOW <variable>
1148
1152
///
1149
1153
/// Note: this is a PostgreSQL-specific statement.
@@ -2033,6 +2037,13 @@ impl fmt::Display for Statement {
2033
2037
}
2034
2038
Ok ( ( ) )
2035
2039
}
2040
+ Statement :: ShowFunctions { filter } => {
2041
+ write ! ( f, "SHOW FUNCTIONS" ) ?;
2042
+ if let Some ( filter) = filter {
2043
+ write ! ( f, " {}" , filter) ?;
2044
+ }
2045
+ Ok ( ( ) )
2046
+ }
2036
2047
Statement :: Use { db_name } => {
2037
2048
write ! ( f, "USE {}" , db_name) ?;
2038
2049
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -250,6 +250,7 @@ define_keywords!(
250
250
FROM ,
251
251
FULL ,
252
252
FUNCTION ,
253
+ FUNCTIONS ,
253
254
FUSION ,
254
255
GET ,
255
256
GLOBAL ,
Original file line number Diff line number Diff line change @@ -3854,6 +3854,8 @@ impl<'a> Parser<'a> {
3854
3854
Ok ( self . parse_show_columns ( extended, full) ?)
3855
3855
} else if self . parse_keyword ( Keyword :: TABLES ) {
3856
3856
Ok ( self . parse_show_tables ( extended, full) ?)
3857
+ } else if self . parse_keyword ( Keyword :: FUNCTIONS ) {
3858
+ Ok ( self . parse_show_functions ( ) ?)
3857
3859
} else if extended || full {
3858
3860
Err ( ParserError :: ParserError (
3859
3861
"EXTENDED/FULL are not supported with this type of SHOW query" . to_string ( ) ,
@@ -3945,6 +3947,11 @@ impl<'a> Parser<'a> {
3945
3947
} )
3946
3948
}
3947
3949
3950
+ pub fn parse_show_functions ( & mut self ) -> Result < Statement , ParserError > {
3951
+ let filter = self . parse_show_statement_filter ( ) ?;
3952
+ Ok ( Statement :: ShowFunctions { filter } )
3953
+ }
3954
+
3948
3955
pub fn parse_show_collation ( & mut self ) -> Result < Statement , ParserError > {
3949
3956
let filter = self . parse_show_statement_filter ( ) ?;
3950
3957
Ok ( Statement :: ShowCollation { filter } )
Original file line number Diff line number Diff line change @@ -5569,3 +5569,13 @@ fn parse_cursor() {
5569
5569
_ => unreachable ! ( ) ,
5570
5570
}
5571
5571
}
5572
+
5573
+ #[ test]
5574
+ fn parse_show_functions ( ) {
5575
+ assert_eq ! (
5576
+ verified_stmt( "SHOW FUNCTIONS LIKE 'pattern'" ) ,
5577
+ Statement :: ShowFunctions {
5578
+ filter: Some ( ShowStatementFilter :: Like ( "pattern" . into( ) ) ) ,
5579
+ }
5580
+ ) ;
5581
+ }
You can’t perform that action at this time.
0 commit comments