Fix #1181, correct qualify of function argument type

This commit is contained in:
steve-chavez
2018-11-06 11:54:10 -05:00
committed by Steve Chávez
parent ab23ed7999
commit 63ead89470
8 changed files with 59 additions and 39 deletions
+5
View File
@@ -371,3 +371,8 @@ spec =
get "/rpc/get_tsearch?text_search_vector=not.fts(english).fun%7Crat" `shouldRespondWith`
[json|[{"text_search_vector":"'amus':5 'fair':7 'impossibl':9 'peu':4"},{"text_search_vector":"'art':4 'spass':5 'unmog':7"}]|]
{ matchHeaders = [matchContentTypeJson] }
it "should work with an argument of custom type in public schema" $ do
get "/rpc/test_arg?my_arg=something" `shouldRespondWith`
[json|"foobar"|]
{ matchHeaders = [matchContentTypeJson] }
+4 -1
View File
@@ -4,6 +4,7 @@ import Test.Hspec
import SpecHelper
import qualified Hasql.Pool as P
import qualified Hasql.Transaction.Sessions as HT
import PostgREST.App (postgrest)
import PostgREST.DbStructure (getDbStructure, getPgVersion)
@@ -46,7 +47,9 @@ main = do
pool <- P.acquire (3, 10, toS testDbConn)
result <- P.use pool $ getDbStructure "test" =<< getPgVersion
result <- P.use pool $ do
ver <- getPgVersion
HT.transaction HT.ReadCommitted HT.Read $ getDbStructure "test" ver
dbStructure <- pure $ either (panic.show) id result
+6
View File
@@ -1602,3 +1602,9 @@ create table test.contract (
create view test.player_view as select * from private.player;
create view test.contract_view as select * from test.contract;
create type public.my_type AS enum ('something');
CREATE FUNCTION test.test_arg(my_arg public.my_type) RETURNS text AS $$
SELECT 'foobar'::text;
$$ LANGUAGE sql;