Fix overloading of functions with unnamed arguments (specifically for prefer params=single-object)

This commit is contained in:
Wolfgang Walther
2020-11-20 09:24:32 -05:00
committed by Steve Chavez
parent b091586394
commit e08bb3a197
4 changed files with 26 additions and 1 deletions
+13
View File
@@ -284,6 +284,19 @@ spec actualPgVersion =
[json|null|]
{ matchHeaders = [matchContentTypeJson] }
context "different types when overloaded" $ do
it "returns composite type" $
post "/rpc/ret_point_overloaded" [json|{"x": 1, "y": 2}|] `shouldRespondWith`
[json|[{"x": 1, "y": 2}]|]
{ matchHeaders = [matchContentTypeJson] }
it "returns json scalar with prefer single object" $
request methodPost "/rpc/ret_point_overloaded" [("Prefer","params=single-object")]
[json|{"x": 1, "y": 2}|]
`shouldRespondWith`
[json|{"x": 1, "y": 2}|]
{ matchHeaders = [matchContentTypeJson] }
context "proc argument types" $ do
-- different syntax for array needed for pg<10
when (actualPgVersion < pgVersion100) $
+8
View File
@@ -983,6 +983,14 @@ create function test.ret_point_2d() returns test.point_2d as $$
select row(10, 5)::test.point_2d;
$$ language sql;
create function test.ret_point_overloaded(x int, y int) returns test.point_2d as $$
select row(x, y)::test.point_2d;
$$ language sql;
create function test.ret_point_overloaded(json) returns json as $$
select $1;
$$ language sql;
-- domains on composite types are only supported from pg 11 on
do $do$begin
if (SELECT current_setting('server_version_num')::int >= 110000) then