@@ -4556,7 +4556,7 @@ impl<'a> Parser<'a> {
4556
4556
} else if self.parse_keyword(Keyword::EXTERNAL) {
4557
4557
self.parse_create_external_table(or_replace)
4558
4558
} else if self.parse_keyword(Keyword::FUNCTION) {
4559
- self.parse_create_function(or_replace, temporary)
4559
+ self.parse_create_function(or_alter, or_replace, temporary)
4560
4560
} else if self.parse_keyword(Keyword::TRIGGER) {
4561
4561
self.parse_create_trigger(or_replace, false)
4562
4562
} else if self.parse_keywords(&[Keyword::CONSTRAINT, Keyword::TRIGGER]) {
@@ -4865,6 +4865,7 @@ impl<'a> Parser<'a> {
4865
4865
4866
4866
pub fn parse_create_function(
4867
4867
&mut self,
4868
+ or_alter: bool,
4868
4869
or_replace: bool,
4869
4870
temporary: bool,
4870
4871
) -> Result<Statement, ParserError> {
@@ -4877,7 +4878,7 @@ impl<'a> Parser<'a> {
4877
4878
} else if dialect_of!(self is BigQueryDialect) {
4878
4879
self.parse_bigquery_create_function(or_replace, temporary)
4879
4880
} else if dialect_of!(self is MsSqlDialect) {
4880
- self.parse_mssql_create_function(or_replace, temporary)
4881
+ self.parse_mssql_create_function(or_alter, or_replace, temporary)
4881
4882
} else {
4882
4883
self.prev_token();
4883
4884
self.expected("an object type after CREATE", self.peek_token())
@@ -4992,6 +4993,7 @@ impl<'a> Parser<'a> {
4992
4993
}
4993
4994
4994
4995
Ok(Statement::CreateFunction(CreateFunction {
4996
+ or_alter: false,
4995
4997
or_replace,
4996
4998
temporary,
4997
4999
name,
@@ -5025,6 +5027,7 @@ impl<'a> Parser<'a> {
5025
5027
let using = self.parse_optional_create_function_using()?;
5026
5028
5027
5029
Ok(Statement::CreateFunction(CreateFunction {
5030
+ or_alter: false,
5028
5031
or_replace,
5029
5032
temporary,
5030
5033
name,
@@ -5114,6 +5117,7 @@ impl<'a> Parser<'a> {
5114
5117
};
5115
5118
5116
5119
Ok(Statement::CreateFunction(CreateFunction {
5120
+ or_alter: false,
5117
5121
or_replace,
5118
5122
temporary,
5119
5123
if_not_exists,
@@ -5137,6 +5141,7 @@ impl<'a> Parser<'a> {
5137
5141
/// [MsSql]: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql
5138
5142
fn parse_mssql_create_function(
5139
5143
&mut self,
5144
+ or_alter: bool,
5140
5145
or_replace: bool,
5141
5146
temporary: bool,
5142
5147
) -> Result<Statement, ParserError> {
@@ -5169,6 +5174,7 @@ impl<'a> Parser<'a> {
5169
5174
self.expect_keyword_is(Keyword::END)?;
5170
5175
5171
5176
Ok(Statement::CreateFunction(CreateFunction {
5177
+ or_alter,
5172
5178
or_replace,
5173
5179
temporary,
5174
5180
if_not_exists: false,
0 commit comments