File tree 4 files changed +35
-35
lines changed
4 files changed +35
-35
lines changed Original file line number Diff line number Diff line change @@ -3283,14 +3283,14 @@ pub enum Statement {
3283
3283
/// ```
3284
3284
/// listen for a notification channel
3285
3285
///
3286
- /// See Postgres <https://www.postgresql.org/docs/current/sql-notify .html>
3286
+ /// See Postgres <https://www.postgresql.org/docs/current/sql-listen .html>
3287
3287
LISTEN { channel : Ident } ,
3288
3288
/// ```sql
3289
3289
/// NOTIFY channel [ , payload ]
3290
3290
/// ```
3291
3291
/// send a notification event together with an optional “payload” string to channel
3292
3292
///
3293
- /// See Postgres <https://www.postgresql.org/docs/current/sql-listen .html>
3293
+ /// See Postgres <https://www.postgresql.org/docs/current/sql-notify .html>
3294
3294
NOTIFY {
3295
3295
channel : Ident ,
3296
3296
payload : Option < String > ,
Original file line number Diff line number Diff line change @@ -534,8 +534,8 @@ impl<'a> Parser<'a> {
534
534
Keyword :: MERGE => self . parse_merge ( ) ,
535
535
// `LISTEN` and `NOTIFY` are Postgres-specific
536
536
// syntaxes. They are used for Postgres statement.
537
- Keyword :: LISTEN => self . parse_listen ( ) ,
538
- Keyword :: NOTIFY => self . parse_notify ( ) ,
537
+ Keyword :: LISTEN if dialect_of ! ( self is PostgreSqlDialect | GenericDialect ) => self . parse_listen ( ) ,
538
+ Keyword :: NOTIFY if dialect_of ! ( self is PostgreSqlDialect | GenericDialect ) => self . parse_notify ( ) ,
539
539
// `PRAGMA` is sqlite specific https://www.sqlite.org/pragma.html
540
540
Keyword :: PRAGMA => self . parse_pragma ( ) ,
541
541
Keyword :: UNLOAD => self . parse_unload ( ) ,
Original file line number Diff line number Diff line change @@ -11460,34 +11460,3 @@ fn test_try_convert() {
11460
11460
all_dialects_where ( |d| d. supports_try_convert ( ) && !d. convert_type_before_value ( ) ) ;
11461
11461
dialects. verified_expr ( "TRY_CONVERT('foo', VARCHAR(MAX))" ) ;
11462
11462
}
11463
-
11464
- #[ test]
11465
- fn test_listen ( ) {
11466
- match verified_stmt ( "LISTEN test1" ) {
11467
- Statement :: LISTEN { channel } => {
11468
- assert_eq ! ( Ident :: new( "test1" ) , channel) ;
11469
- }
11470
- _ => unreachable ! ( ) ,
11471
- }
11472
- }
11473
-
11474
- #[ test]
11475
- fn test_notify ( ) {
11476
- match verified_stmt ( "NOTIFY test1" ) {
11477
- Statement :: NOTIFY { channel, payload } => {
11478
- assert_eq ! ( Ident :: new( "test1" ) , channel) ;
11479
- assert_eq ! ( payload, None ) ;
11480
- }
11481
- _ => unreachable ! ( ) ,
11482
- }
11483
- match verified_stmt ( "NOTIFY test1, 'this is a test notification'" ) {
11484
- Statement :: NOTIFY {
11485
- channel,
11486
- payload : Some ( payload) ,
11487
- } => {
11488
- assert_eq ! ( Ident :: new( "test1" ) , channel) ;
11489
- assert_eq ! ( "this is a test notification" , payload) ;
11490
- }
11491
- _ => unreachable ! ( ) ,
11492
- }
11493
- }
Original file line number Diff line number Diff line change @@ -5157,3 +5157,34 @@ fn parse_create_type_as_enum() {
5157
5157
_ => unreachable ! ( ) ,
5158
5158
}
5159
5159
}
5160
+
5161
+ #[ test]
5162
+ fn parse_listen_channel ( ) {
5163
+ match pg_and_generic ( ) . verified_stmt ( "LISTEN test1" ) {
5164
+ Statement :: LISTEN { channel } => {
5165
+ assert_eq ! ( Ident :: new( "test1" ) , channel) ;
5166
+ }
5167
+ _ => unreachable ! ( ) ,
5168
+ }
5169
+ }
5170
+
5171
+ #[ test]
5172
+ fn parse_notify_channel ( ) {
5173
+ match pg_and_generic ( ) . verified_stmt ( "NOTIFY test1" ) {
5174
+ Statement :: NOTIFY { channel, payload } => {
5175
+ assert_eq ! ( Ident :: new( "test1" ) , channel) ;
5176
+ assert_eq ! ( payload, None ) ;
5177
+ }
5178
+ _ => unreachable ! ( ) ,
5179
+ }
5180
+ match pg_and_generic ( ) . verified_stmt ( "NOTIFY test1, 'this is a test notification'" ) {
5181
+ Statement :: NOTIFY {
5182
+ channel,
5183
+ payload : Some ( payload) ,
5184
+ } => {
5185
+ assert_eq ! ( Ident :: new( "test1" ) , channel) ;
5186
+ assert_eq ! ( "this is a test notification" , payload) ;
5187
+ }
5188
+ _ => unreachable ! ( ) ,
5189
+ }
5190
+ }
You can’t perform that action at this time.
0 commit comments