File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 55
55
56
56
let query_parts: Vec < & str > = query. trim_end_matches ( ';' ) . split_whitespace ( ) . collect ( ) ;
57
57
58
- match query_parts[ 0 ] . to_ascii_uppercase ( ) . as_str ( ) {
58
+ match query_parts
59
+ . first ( )
60
+ . unwrap_or ( & "" )
61
+ . to_ascii_uppercase ( )
62
+ . as_str ( )
63
+ {
59
64
"BAN" => {
60
65
trace ! ( "BAN" ) ;
61
66
ban ( stream, query_parts) . await
84
89
trace ! ( "SHUTDOWN" ) ;
85
90
shutdown ( stream) . await
86
91
}
87
- "SHOW" => match query_parts[ 1 ] . to_ascii_uppercase ( ) . as_str ( ) {
92
+ "SHOW" => match query_parts
93
+ . get ( 1 )
94
+ . unwrap_or ( & "" )
95
+ . to_ascii_uppercase ( )
96
+ . as_str ( )
97
+ {
88
98
"HELP" => {
89
99
trace ! ( "SHOW HELP" ) ;
90
100
show_help ( stream) . await
Original file line number Diff line number Diff line change 91
91
end
92
92
end
93
93
94
+ [
95
+ "SHOW ME THE MONEY" ,
96
+ "SHOW ME THE WAY" ,
97
+ "SHOW UP" ,
98
+ "SHOWTIME" ,
99
+ "HAMMER TIME" ,
100
+ "SHOWN TO BE TRUE" ,
101
+ "SHOW " ,
102
+ "SHOW " ,
103
+ "SHOW 1" ,
104
+ ";;;;;"
105
+ ] . each do |cmd |
106
+ describe "Bad command #{ cmd } " do
107
+ it "does not panic and responds with PG::SystemError" do
108
+ admin_conn = PG ::connect ( processes . pgcat . admin_connection_string )
109
+ expect { admin_conn . async_exec ( cmd ) } . to raise_error ( PG ::SystemError ) . with_message ( /Unsupported/ )
110
+ admin_conn . close
111
+ end
112
+ end
113
+ end
114
+
94
115
describe "PAUSE" do
95
116
it "pauses all pools" do
96
117
admin_conn = PG ::connect ( processes . pgcat . admin_connection_string )
You can’t perform that action at this time.
0 commit comments