@@ -1959,6 +1959,8 @@ impl<'a> Parser<'a> {
19591959 . map_parser_err ( StatementKind :: CreateConnection )
19601960 } else if self . peek_keywords ( & [ MATERIALIZED , VIEW ] )
19611961 || self . peek_keywords ( & [ OR , REPLACE , MATERIALIZED , VIEW ] )
1962+ || self . peek_keywords ( & [ REPLACEMENT , MATERIALIZED , VIEW ] )
1963+ || self . peek_keywords ( & [ OR , REPLACE , REPLACEMENT , MATERIALIZED , VIEW ] )
19621964 {
19631965 self . parse_create_materialized_view ( )
19641966 . map_parser_err ( StatementKind :: CreateMaterializedView )
@@ -3855,17 +3857,20 @@ impl<'a> Parser<'a> {
38553857 } else {
38563858 IfExistsBehavior :: Error
38573859 } ;
3860+ let replacement = self . parse_keyword ( REPLACEMENT ) ;
38583861 self . expect_keywords ( & [ MATERIALIZED , VIEW ] ) ?;
38593862 if if_exists == IfExistsBehavior :: Error && self . parse_if_not_exists ( ) ? {
38603863 if_exists = IfExistsBehavior :: Skip ;
38613864 }
38623865
38633866 let name = self . parse_item_name ( ) ?;
38643867 let columns = self . parse_parenthesized_column_list ( Optional ) ?;
3865- let replacing = self
3866- . parse_keyword ( REPLACING )
3867- . then ( || self . parse_raw_name ( ) )
3868- . transpose ( ) ?;
3868+ let replacement_for = if replacement {
3869+ self . expect_keyword ( FOR ) ?;
3870+ Some ( self . parse_raw_name ( ) ?)
3871+ } else {
3872+ None
3873+ } ;
38693874 let in_cluster = self . parse_optional_in_cluster ( ) ?;
38703875
38713876 let with_options = if self . parse_keyword ( WITH ) {
@@ -3886,7 +3891,7 @@ impl<'a> Parser<'a> {
38863891 if_exists,
38873892 name,
38883893 columns,
3889- replacing ,
3894+ replacement_for ,
38903895 in_cluster,
38913896 query,
38923897 as_of,
0 commit comments