fix: Return array of objects for RPCs with single-column TABLE return type
This is a regression after changing responses for RPCs with INOUT or OUT arguments in #1615. Resolves #1930.
This commit is contained in:
committed by
Steve Chavez
parent
d4c6abbaec
commit
b05898d17f
@@ -572,6 +572,17 @@ spec actualPgVersion =
|
||||
`shouldRespondWith`
|
||||
[json|{"num":1,"str":"two","b":false}|]
|
||||
|
||||
context "procs with TABLE return" $ do
|
||||
it "returns an object result when there is a single-column TABLE return type" $
|
||||
get "/rpc/single_column_table_return"
|
||||
`shouldRespondWith`
|
||||
[json|[{"a": "A"}]|]
|
||||
|
||||
it "returns an object result when there is a multi-column TABLE return type" $
|
||||
get "/rpc/multi_column_table_return"
|
||||
`shouldRespondWith`
|
||||
[json|[{"a": "A", "b": "B"}]|]
|
||||
|
||||
context "procs with VARIADIC params" $ do
|
||||
when (actualPgVersion < pgVersion100) $
|
||||
it "works with POST (Postgres < 10)" $
|
||||
|
||||
Vendored
+8
@@ -1203,6 +1203,14 @@ create function test.many_inout_params(INOUT num int, INOUT str text, INOUT b bo
|
||||
select num, str, b;
|
||||
$$ language sql;
|
||||
|
||||
create function test.single_column_table_return () returns table (a text) AS $$
|
||||
select 'A'::text;
|
||||
$$ language sql;
|
||||
|
||||
create function test.multi_column_table_return () returns table (a text, b text) AS $$
|
||||
select 'A'::text, 'B'::text;
|
||||
$$ language sql;
|
||||
|
||||
CREATE FUNCTION test.variadic_param(VARIADIC v TEXT[] DEFAULT '{}') RETURNS text[]
|
||||
IMMUTABLE
|
||||
LANGUAGE SQL AS $$
|
||||
|
||||
Reference in New Issue
Block a user