@@ -15207,34 +15207,39 @@ fn parse_comments() {
1520715207
1520815208 // https://www.postgresql.org/docs/current/sql-comment.html
1520915209 let object_types = [
15210- ("COLUMN", CommentObject::Column),
15211- ("DATABASE", CommentObject::Database),
15212- ("DOMAIN", CommentObject::Domain),
15213- ("EXTENSION", CommentObject::Extension),
15214- ("FUNCTION", CommentObject::Function),
15215- ("INDEX", CommentObject::Index),
15216- ("MATERIALIZED VIEW", CommentObject::MaterializedView),
15217- ("PROCEDURE", CommentObject::Procedure),
15218- ("ROLE", CommentObject::Role),
15219- ("SCHEMA", CommentObject::Schema),
15220- ("SEQUENCE", CommentObject::Sequence),
15221- ("TABLE", CommentObject::Table),
15222- ("TYPE", CommentObject::Type),
15223- ("USER", CommentObject::User),
15224- ("VIEW", CommentObject::View),
15210+ ("COLUMN", CommentObject::Column, "db.t0"),
15211+ ("DATABASE", CommentObject::Database, "db.t0"),
15212+ ("DOMAIN", CommentObject::Domain, "db.t0"),
15213+ ("EXTENSION", CommentObject::Extension, "db.t0"),
15214+ ("FUNCTION", CommentObject::Function, "db.t0"),
15215+ ("INDEX", CommentObject::Index, "db.t0"),
15216+ (
15217+ "MATERIALIZED VIEW",
15218+ CommentObject::MaterializedView,
15219+ "db.t0",
15220+ ),
15221+ ("PROCEDURE", CommentObject::Procedure, "db.t0"),
15222+ ("ROLE", CommentObject::Role, "db.t0"),
15223+ ("SCHEMA", CommentObject::Schema, "db.t0"),
15224+ ("SEQUENCE", CommentObject::Sequence, "db.t0"),
15225+ ("SUBSCRIPTION", CommentObject::Subscription, "t0"),
15226+ ("TABLE", CommentObject::Table, "db.t0"),
15227+ ("TYPE", CommentObject::Type, "db.t0"),
15228+ ("USER", CommentObject::User, "db.t0"),
15229+ ("VIEW", CommentObject::View, "db.t0"),
1522515230 ];
15226- for (keyword, expected_object_type) in object_types.iter() {
15227- match all_dialects_where(|d| d.supports_comment_on())
15228- .verified_stmt( format!("COMMENT IF EXISTS ON {keyword} db.t0 IS 'comment'").as_str())
15229- {
15231+ for (keyword, expected_object_type, object_name_sql ) in object_types.iter() {
15232+ match all_dialects_where(|d| d.supports_comment_on()).verified_stmt(
15233+ format!("COMMENT IF EXISTS ON {keyword} {object_name_sql} IS 'comment'").as_str(),
15234+ ) {
1523015235 Statement::Comment {
1523115236 object_type,
1523215237 object_name,
1523315238 comment: Some(comment),
1523415239 if_exists,
1523515240 } => {
1523615241 assert_eq!("comment", comment);
15237- assert_eq!("db.t0" , object_name.to_string());
15242+ assert_eq!(*object_name_sql , object_name.to_string());
1523815243 assert_eq!(*expected_object_type, object_type);
1523915244 assert!(if_exists);
1524015245 }
@@ -18363,6 +18368,18 @@ fn parse_reset_statement() {
1836318368 Statement::Reset(ResetStatement { reset }) => assert_eq!(reset, Reset::ALL),
1836418369 _ => unreachable!(),
1836518370 }
18371+ let postgres = TestedDialects::new(vec![Box::new(PostgreSqlDialect {})]);
18372+ match postgres.verified_stmt("RESET SESSION AUTHORIZATION") {
18373+ Statement::Reset(ResetStatement { reset }) => {
18374+ assert_eq!(reset, Reset::SessionAuthorization)
18375+ }
18376+ _ => unreachable!(),
18377+ }
18378+
18379+ let non_pg = all_dialects_where(|d| !d.is::<PostgreSqlDialect>());
18380+ assert!(non_pg
18381+ .parse_sql_statements("RESET SESSION AUTHORIZATION")
18382+ .is_err());
1836618383}
1836718384
1836818385#[test]
0 commit comments