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 5555
5656 let query_parts: Vec < & str > = query. trim_end_matches ( ';' ) . split_whitespace ( ) . collect ( ) ;
5757
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+ {
5964 "BAN" => {
6065 trace ! ( "BAN" ) ;
6166 ban ( stream, query_parts) . await
8489 trace ! ( "SHUTDOWN" ) ;
8590 shutdown ( stream) . await
8691 }
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+ {
8898 "HELP" => {
8999 trace ! ( "SHOW HELP" ) ;
90100 show_help ( stream) . await
Original file line number Diff line number Diff line change 9191 end
9292 end
9393
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+
94115 describe "PAUSE" do
95116 it "pauses all pools" do
96117 admin_conn = PG ::connect ( processes . pgcat . admin_connection_string )
You can’t perform that action at this time.
0 commit comments