File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -302,4 +302,8 @@ impl Dialect for PostgreSqlDialect {
302302 fn supports_insert_table_alias ( & self ) -> bool {
303303 true
304304 }
305+
306+ fn supports_create_table_like_parenthesized ( & self ) -> bool {
307+ true
308+ }
305309}
Original file line number Diff line number Diff line change @@ -593,6 +593,45 @@ fn parse_create_table_constraints_only() {
593593 } ;
594594}
595595
596+ #[ test]
597+ fn parse_create_table_like_with_defaults ( ) {
598+ let sql = "CREATE TABLE new (LIKE old INCLUDING DEFAULTS)" ;
599+ match pg ( ) . verified_stmt ( sql) {
600+ Statement :: CreateTable ( stmt) => {
601+ assert_eq ! (
602+ stmt. name,
603+ ObjectName :: from( vec![ Ident :: new( "new" . to_string( ) ) ] )
604+ ) ;
605+ assert_eq ! (
606+ stmt. like,
607+ Some ( CreateTableLikeKind :: Parenthesized ( CreateTableLike {
608+ name: ObjectName :: from( vec![ Ident :: new( "old" . to_string( ) ) ] ) ,
609+ defaults: Some ( CreateTableLikeDefaults :: Including ) ,
610+ } ) )
611+ )
612+ }
613+ _ => unreachable ! ( ) ,
614+ }
615+
616+ let sql = "CREATE TABLE new (LIKE old EXCLUDING DEFAULTS)" ;
617+ match pg ( ) . verified_stmt ( sql) {
618+ Statement :: CreateTable ( stmt) => {
619+ assert_eq ! (
620+ stmt. name,
621+ ObjectName :: from( vec![ Ident :: new( "new" . to_string( ) ) ] )
622+ ) ;
623+ assert_eq ! (
624+ stmt. like,
625+ Some ( CreateTableLikeKind :: Parenthesized ( CreateTableLike {
626+ name: ObjectName :: from( vec![ Ident :: new( "old" . to_string( ) ) ] ) ,
627+ defaults: Some ( CreateTableLikeDefaults :: Excluding ) ,
628+ } ) )
629+ )
630+ }
631+ _ => unreachable ! ( ) ,
632+ }
633+ }
634+
596635#[ test]
597636fn parse_alter_table_constraints_rename ( ) {
598637 match alter_table_op (
You can’t perform that action at this time.
0 commit comments