Uses anti_id computed column to make test case clearer

This commit is contained in:
Diogo Biazus
2015-12-02 17:12:37 -05:00
parent c2e3dd716c
commit 65e7744858
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ spec =
[json| [{"id":1},{"id":2},{"id":3},{"id":4},{"id":5},{"id":6},{"id":7},{"id":8},{"id":9},{"id":10},{"id":11},{"id":12},{"id":13},{"id":14},{"id":15}] |]
it "order by computed column" $
get "/items?order=always_true.asc,id.asc" `shouldRespondWith`
get "/items?order=anti_id.desc" `shouldRespondWith`
[json| [{"id":1},{"id":2},{"id":3},{"id":4},{"id":5},{"id":6},{"id":7},{"id":8},{"id":9},{"id":10},{"id":11},{"id":12},{"id":13},{"id":14},{"id":15}] |]
it "matches filtering nested items" $
+5
View File
@@ -462,6 +462,11 @@ CREATE FUNCTION public.always_true(test.items) RETURNS boolean
ALTER FUNCTION public.always_true(test.items) OWNER TO postgrest_test;
CREATE FUNCTION public.anti_id(test.items) RETURNS bigint
LANGUAGE sql STABLE
AS $$ SELECT $1.id * -1 $$;
ALTER FUNCTION public.anti_id(test.items) OWNER TO postgrest_test;
ALTER TABLE ONLY authors_only