mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Fix DDL generation in case of an empty arguments function. (#1690)
This commit is contained in:
parent
252fdbab82
commit
a7e984099f
2 changed files with 3 additions and 0 deletions
|
@ -2011,6 +2011,8 @@ impl fmt::Display for CreateFunction {
|
|||
)?;
|
||||
if let Some(args) = &self.args {
|
||||
write!(f, "({})", display_comma_separated(args))?;
|
||||
} else {
|
||||
write!(f, "()")?;
|
||||
}
|
||||
if let Some(return_type) = &self.return_type {
|
||||
write!(f, " RETURNS {return_type}")?;
|
||||
|
|
|
@ -3802,6 +3802,7 @@ fn parse_create_function_detailed() {
|
|||
pg_and_generic().verified_stmt("CREATE OR REPLACE FUNCTION add(a INTEGER, IN b INTEGER = 1) RETURNS INTEGER LANGUAGE SQL STABLE PARALLEL UNSAFE RETURN a + b");
|
||||
pg_and_generic().verified_stmt("CREATE OR REPLACE FUNCTION add(a INTEGER, IN b INTEGER = 1) RETURNS INTEGER LANGUAGE SQL STABLE CALLED ON NULL INPUT PARALLEL UNSAFE RETURN a + b");
|
||||
pg_and_generic().verified_stmt(r#"CREATE OR REPLACE FUNCTION increment(i INTEGER) RETURNS INTEGER LANGUAGE plpgsql AS $$ BEGIN RETURN i + 1; END; $$"#);
|
||||
pg_and_generic().verified_stmt(r#"CREATE OR REPLACE FUNCTION no_arg() RETURNS VOID LANGUAGE plpgsql AS $$ BEGIN DELETE FROM my_table; END; $$"#);
|
||||
}
|
||||
#[test]
|
||||
fn parse_incorrect_create_function_parallel() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue