Skip to content

Commit 624c0f7

Browse files
committed
simplify test
1 parent c0d6fe1 commit 624c0f7

File tree

1 file changed

+3
-38
lines changed

1 file changed

+3
-38
lines changed

tests/sqlparser_postgres.rs

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4475,44 +4475,9 @@ fn parse_create_function_detailed() {
44754475
pg_and_generic().verified_stmt(r#"CREATE OR REPLACE FUNCTION increment(i INTEGER) RETURNS INTEGER LANGUAGE plpgsql AS $$ BEGIN RETURN i + 1; END; $$"#);
44764476
pg_and_generic().verified_stmt(r#"CREATE OR REPLACE FUNCTION no_arg() RETURNS VOID LANGUAGE plpgsql AS $$ BEGIN DELETE FROM my_table; END; $$"#);
44774477
pg_and_generic().verified_stmt(r#"CREATE OR REPLACE FUNCTION return_table(i INTEGER) RETURNS TABLE(id UUID, is_active BOOLEAN) LANGUAGE plpgsql AS $$ BEGIN RETURN QUERY SELECT NULL::UUID, NULL::BOOLEAN; END; $$"#);
4478-
}
4479-
4480-
#[test]
4481-
fn parse_create_function_unnamed_default_syntax() {
4482-
let sql =
4483-
"CREATE FUNCTION add(INTEGER, INTEGER DEFAULT 1) RETURNS INTEGER AS 'select $1 + $2;'";
4484-
let canonical =
4485-
"CREATE FUNCTION add(INTEGER, INTEGER = 1) RETURNS INTEGER AS 'select $1 + $2;'";
4486-
assert_eq!(
4487-
pg_and_generic().one_statement_parses_to(sql, canonical),
4488-
Statement::CreateFunction(CreateFunction {
4489-
or_alter: false,
4490-
or_replace: false,
4491-
temporary: false,
4492-
name: ObjectName::from(vec![Ident::new("add")]),
4493-
args: Some(vec![
4494-
OperateFunctionArg::unnamed(DataType::Integer(None)),
4495-
OperateFunctionArg {
4496-
mode: None,
4497-
name: None,
4498-
data_type: DataType::Integer(None),
4499-
default_expr: Some(Expr::Value(number("1").with_empty_span())),
4500-
},
4501-
]),
4502-
return_type: Some(DataType::Integer(None)),
4503-
language: None,
4504-
behavior: None,
4505-
called_on_null: None,
4506-
parallel: None,
4507-
function_body: Some(CreateFunctionBody::AsBeforeOptions(Expr::Value(
4508-
(Value::SingleQuotedString("select $1 + $2;".into())).with_empty_span()
4509-
))),
4510-
if_not_exists: false,
4511-
using: None,
4512-
determinism_specifier: None,
4513-
options: None,
4514-
remote_connection: None,
4515-
})
4478+
pg_and_generic().one_statement_parses_to(
4479+
"CREATE FUNCTION add(INTEGER, INTEGER DEFAULT 1) RETURNS INTEGER AS 'select $1 + $2;'",
4480+
"CREATE FUNCTION add(INTEGER, INTEGER = 1) RETURNS INTEGER AS 'select $1 + $2;'",
45164481
);
45174482
}
45184483

0 commit comments

Comments
 (0)