@@ -11595,7 +11595,7 @@ fn test_show_dbs_schemas_tables_views() {
1159511595
1159611596#[ test]
1159711597fn parse_listen_channel ( ) {
11598- let dialects = all_dialects_where ( |d| d. supports_listen ( ) ) ;
11598+ let dialects = all_dialects_where ( |d| d. supports_listen_notify ( ) ) ;
1159911599
1160011600 match dialects. verified_stmt ( "LISTEN test1" ) {
1160111601 Statement :: LISTEN { channel } => {
@@ -11609,17 +11609,48 @@ fn parse_listen_channel() {
1160911609 ParserError :: ParserError ( "Expected: identifier, found: *" . to_string( ) )
1161011610 ) ;
1161111611
11612- let dialects = all_dialects_where ( |d| !d. supports_listen ( ) ) ;
11612+ let dialects = all_dialects_where ( |d| !d. supports_listen_notify ( ) ) ;
1161311613
1161411614 assert_eq ! (
1161511615 dialects. parse_sql_statements( "LISTEN test1" ) . unwrap_err( ) ,
1161611616 ParserError :: ParserError ( "Expected: an SQL statement, found: LISTEN" . to_string( ) )
1161711617 ) ;
1161811618}
1161911619
11620+ #[ test]
11621+ fn parse_unlisten_channel ( ) {
11622+ let dialects = all_dialects_where ( |d| d. supports_listen_notify ( ) ) ;
11623+
11624+ match dialects. verified_stmt ( "UNLISTEN test1" ) {
11625+ Statement :: UNLISTEN { channel } => {
11626+ assert_eq ! ( Ident :: new( "test1" ) , channel) ;
11627+ }
11628+ _ => unreachable ! ( ) ,
11629+ } ;
11630+
11631+ match dialects. verified_stmt ( "UNLISTEN *" ) {
11632+ Statement :: UNLISTEN { channel } => {
11633+ assert_eq ! ( Ident :: new( "*" ) , channel) ;
11634+ }
11635+ _ => unreachable ! ( ) ,
11636+ } ;
11637+
11638+ assert_eq ! (
11639+ dialects. parse_sql_statements( "UNLISTEN +" ) . unwrap_err( ) ,
11640+ ParserError :: ParserError ( "Expected: wildcard or identifier, found: +" . to_string( ) )
11641+ ) ;
11642+
11643+ let dialects = all_dialects_where ( |d| !d. supports_listen_notify ( ) ) ;
11644+
11645+ assert_eq ! (
11646+ dialects. parse_sql_statements( "UNLISTEN test1" ) . unwrap_err( ) ,
11647+ ParserError :: ParserError ( "Expected: an SQL statement, found: UNLISTEN" . to_string( ) )
11648+ ) ;
11649+ }
11650+
1162011651#[ test]
1162111652fn parse_notify_channel ( ) {
11622- let dialects = all_dialects_where ( |d| d. supports_notify ( ) ) ;
11653+ let dialects = all_dialects_where ( |d| d. supports_listen_notify ( ) ) ;
1162311654
1162411655 match dialects. verified_stmt ( "NOTIFY test1" ) {
1162511656 Statement :: NOTIFY { channel, payload } => {
@@ -11655,7 +11686,7 @@ fn parse_notify_channel() {
1165511686 "NOTIFY test1" ,
1165611687 "NOTIFY test1, 'this is a test notification'" ,
1165711688 ] ;
11658- let dialects = all_dialects_where ( |d| !d. supports_notify ( ) ) ;
11689+ let dialects = all_dialects_where ( |d| !d. supports_listen_notify ( ) ) ;
1165911690
1166011691 for & sql in & sql_statements {
1166111692 assert_eq ! (
@@ -11864,6 +11895,44 @@ fn parse_load_data() {
1186411895 ) ;
1186511896}
1186611897
11898+ #[ test]
11899+ fn test_load_extension ( ) {
11900+ let dialects = all_dialects_where ( |d| d. supports_load_extension ( ) ) ;
11901+ let not_supports_load_extension_dialects = all_dialects_where ( |d| !d. supports_load_extension ( ) ) ;
11902+ let sql = "LOAD my_extension" ;
11903+
11904+ match dialects. verified_stmt ( sql) {
11905+ Statement :: Load { extension_name } => {
11906+ assert_eq ! ( Ident :: new( "my_extension" ) , extension_name) ;
11907+ }
11908+ _ => unreachable ! ( ) ,
11909+ } ;
11910+
11911+ assert_eq ! (
11912+ not_supports_load_extension_dialects
11913+ . parse_sql_statements( sql)
11914+ . unwrap_err( ) ,
11915+ ParserError :: ParserError (
11916+ "Expected: `DATA` or an extension name after `LOAD`, found: my_extension" . to_string( )
11917+ )
11918+ ) ;
11919+
11920+ let sql = "LOAD 'filename'" ;
11921+
11922+ match dialects. verified_stmt ( sql) {
11923+ Statement :: Load { extension_name } => {
11924+ assert_eq ! (
11925+ Ident {
11926+ value: "filename" . to_string( ) ,
11927+ quote_style: Some ( '\'' )
11928+ } ,
11929+ extension_name
11930+ ) ;
11931+ }
11932+ _ => unreachable ! ( ) ,
11933+ } ;
11934+ }
11935+
1186711936#[ test]
1186811937fn test_select_top ( ) {
1186911938 let dialects = all_dialects_where ( |d| d. supports_top_before_distinct ( ) ) ;
0 commit comments