@@ -35,7 +35,8 @@ test('list', async () => {
3535 "is_set_returning_function": false,
3636 "language": "sql",
3737 "name": "add",
38- "return_type": "int4",
38+ "return_type": "integer",
39+ "return_type_id": 23,
3940 "return_type_relation_id": null,
4041 "schema": "public",
4142 "security_definer": false,
@@ -134,7 +135,8 @@ test('retrieve, create, update, delete', async () => {
134135 "is_set_returning_function": false,
135136 "language": "sql",
136137 "name": "test_func",
137- "return_type": "int4",
138+ "return_type": "integer",
139+ "return_type_id": 23,
138140 "return_type_relation_id": null,
139141 "schema": "public",
140142 "security_definer": true,
@@ -183,7 +185,8 @@ test('retrieve, create, update, delete', async () => {
183185 "is_set_returning_function": false,
184186 "language": "sql",
185187 "name": "test_func",
186- "return_type": "int4",
188+ "return_type": "integer",
189+ "return_type_id": 23,
187190 "return_type_relation_id": null,
188191 "schema": "public",
189192 "security_definer": true,
@@ -236,7 +239,8 @@ test('retrieve, create, update, delete', async () => {
236239 "is_set_returning_function": false,
237240 "language": "sql",
238241 "name": "test_func_renamed",
239- "return_type": "int4",
242+ "return_type": "integer",
243+ "return_type_id": 23,
240244 "return_type_relation_id": null,
241245 "schema": "test_schema",
242246 "security_definer": true,
@@ -285,7 +289,8 @@ test('retrieve, create, update, delete', async () => {
285289 "is_set_returning_function": false,
286290 "language": "sql",
287291 "name": "test_func_renamed",
288- "return_type": "int4",
292+ "return_type": "integer",
293+ "return_type_id": 23,
289294 "return_type_relation_id": null,
290295 "schema": "test_schema",
291296 "security_definer": true,
@@ -304,3 +309,43 @@ test('retrieve, create, update, delete', async () => {
304309
305310 await pgMeta . schemas . remove ( testSchemaId )
306311} )
312+
313+ test ( 'retrieve set-returning function' , async ( ) => {
314+ const res = await pgMeta . functions . retrieve ( {
315+ schema : 'public' ,
316+ name : 'function_returning_set_of_rows' ,
317+ args : [ ] ,
318+ } )
319+ expect ( res . data ) . toMatchInlineSnapshot (
320+ { id : expect . any ( Number ) } ,
321+ `
322+ {
323+ "args": [],
324+ "argument_types": "",
325+ "behavior": "STABLE",
326+ "complete_statement": "CREATE OR REPLACE FUNCTION public.function_returning_set_of_rows()
327+ RETURNS SETOF users
328+ LANGUAGE sql
329+ STABLE
330+ AS $function$
331+ select * from public.users;
332+ $function$
333+ ",
334+ "config_params": null,
335+ "definition": "
336+ select * from public.users;
337+ ",
338+ "id": Any<Number>,
339+ "identity_argument_types": "",
340+ "is_set_returning_function": true,
341+ "language": "sql",
342+ "name": "function_returning_set_of_rows",
343+ "return_type": "SETOF users",
344+ "return_type_id": 16392,
345+ "return_type_relation_id": 16390,
346+ "schema": "public",
347+ "security_definer": false,
348+ }
349+ `
350+ )
351+ } )
0 commit comments