File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -4642,6 +4642,31 @@ fn parse_create_function_detailed() {
46424642 ) ;
46434643}
46444644
4645+ #[ test]
4646+ fn parse_create_function_returns_setof ( ) {
4647+ let cases = [
4648+ "CREATE FUNCTION any_ids() RETURNS SETOF UUID LANGUAGE sql STABLE AS 'SELECT ''00000000-0000-0000-0000-000000000000''::uuid'" ,
4649+ "CREATE FUNCTION ids_for_user(p_user_id UUID) RETURNS SETOF UUID LANGUAGE sql STABLE AS 'SELECT p_user_id'" ,
4650+ "CREATE FUNCTION ids_from_array() RETURNS SETOF UUID LANGUAGE sql STABLE AS 'SELECT unnest(ARRAY[''00000000-0000-0000-0000-000000000000''::uuid])'" ,
4651+ ] ;
4652+
4653+ for sql in cases {
4654+ match pg_and_generic ( ) . verified_stmt ( sql) {
4655+ Statement :: CreateFunction ( CreateFunction {
4656+ return_type,
4657+ language,
4658+ behavior,
4659+ ..
4660+ } ) => {
4661+ assert_eq ! ( return_type, Some ( DataType :: SetOf ( Box :: new( DataType :: Uuid ) ) ) ) ;
4662+ assert_eq ! ( language, Some ( Ident :: new( "sql" ) ) ) ;
4663+ assert_eq ! ( behavior, Some ( FunctionBehavior :: Stable ) ) ;
4664+ }
4665+ _ => panic ! ( "Expected CreateFunction" ) ,
4666+ }
4667+ }
4668+ }
4669+
46454670#[ test]
46464671fn parse_create_function_with_security ( ) {
46474672 let sql =
You can’t perform that action at this time.
0 commit comments