@@ -35,7 +35,8 @@ test('list', async () => {
35
35
"is_set_returning_function": false,
36
36
"language": "sql",
37
37
"name": "add",
38
- "return_type": "int4",
38
+ "return_type": "integer",
39
+ "return_type_id": 23,
39
40
"return_type_relation_id": null,
40
41
"schema": "public",
41
42
"security_definer": false,
@@ -134,7 +135,8 @@ test('retrieve, create, update, delete', async () => {
134
135
"is_set_returning_function": false,
135
136
"language": "sql",
136
137
"name": "test_func",
137
- "return_type": "int4",
138
+ "return_type": "integer",
139
+ "return_type_id": 23,
138
140
"return_type_relation_id": null,
139
141
"schema": "public",
140
142
"security_definer": true,
@@ -183,7 +185,8 @@ test('retrieve, create, update, delete', async () => {
183
185
"is_set_returning_function": false,
184
186
"language": "sql",
185
187
"name": "test_func",
186
- "return_type": "int4",
188
+ "return_type": "integer",
189
+ "return_type_id": 23,
187
190
"return_type_relation_id": null,
188
191
"schema": "public",
189
192
"security_definer": true,
@@ -236,7 +239,8 @@ test('retrieve, create, update, delete', async () => {
236
239
"is_set_returning_function": false,
237
240
"language": "sql",
238
241
"name": "test_func_renamed",
239
- "return_type": "int4",
242
+ "return_type": "integer",
243
+ "return_type_id": 23,
240
244
"return_type_relation_id": null,
241
245
"schema": "test_schema",
242
246
"security_definer": true,
@@ -285,7 +289,8 @@ test('retrieve, create, update, delete', async () => {
285
289
"is_set_returning_function": false,
286
290
"language": "sql",
287
291
"name": "test_func_renamed",
288
- "return_type": "int4",
292
+ "return_type": "integer",
293
+ "return_type_id": 23,
289
294
"return_type_relation_id": null,
290
295
"schema": "test_schema",
291
296
"security_definer": true,
@@ -304,3 +309,43 @@ test('retrieve, create, update, delete', async () => {
304
309
305
310
await pgMeta . schemas . remove ( testSchemaId )
306
311
} )
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