Skip to content

Commit

Permalink
Merge pull request #200 from supabase/vars_0_4_0
Browse files Browse the repository at this point in the history
Prep for v0.4.0 release
  • Loading branch information
olirice authored Aug 1, 2022
2 parents f8df9ce + 1392242 commit 34cc266
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXTENSION = pg_graphql
DATA = pg_graphql--0.3.3.sql
DATA = pg_graphql--0.4.0.sql

PG_CONFIG = pg_config
SHLIB_LINK = -lgraphqlparser
Expand Down
2 changes: 1 addition & 1 deletion bin/common
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export PG_GRAPHQL_VERSION='0.3.3'
export PG_GRAPHQL_VERSION='0.4.0'

cli_log() {
script_name=${0##*/}
Expand Down
10 changes: 5 additions & 5 deletions pg_graphql--0.3.3.sql → pg_graphql--0.4.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2773,15 +2773,15 @@ begin
on je.k = f.name
loop

-- Null should be ignored
if jsonb_typeof(variable_part) = 'null' or variable_part is null then
continue;
end if;

comp_op = graphql.text_to_comparison_op(op_name);

if comp_op = 'in' then

-- Null should be ignored
if jsonb_typeof(variable_part) = 'null' or variable_part is null then
continue;
end if;

variable_part = graphql.arg_coerce_list(
variable_part
); -- this is now a jsonb array
Expand Down
2 changes: 1 addition & 1 deletion pg_graphql.control
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
comment = 'GraphQL support'
default_version = '0.3.3'
default_version = '0.4.0'
relocatable = false
10 changes: 5 additions & 5 deletions src/sql/resolve/clause/filter/where_clause.sql
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ begin
on je.k = f.name
loop

-- Null should be ignored
if jsonb_typeof(variable_part) = 'null' or variable_part is null then
continue;
end if;

comp_op = graphql.text_to_comparison_op(op_name);

if comp_op = 'in' then

-- Null should be ignored
if jsonb_typeof(variable_part) = 'null' or variable_part is null then
continue;
end if;

variable_part = graphql.arg_coerce_list(
variable_part
); -- this is now a jsonb array
Expand Down
16 changes: 16 additions & 0 deletions test/expected/resolve_connection_filter.out
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ begin;
}
(1 row)

-- filter = null is ignored
select graphql.resolve($${accountCollection(filter: null) { edges { node { id } } }}$$);
resolve
-------------------------------------------------------------------------------------------------------------
{"data": {"accountCollection": {"edges": [{"node": {"id": 1}}, {"node": {"id": 2}}, {"node": {"id": 3}}]}}}
(1 row)

rollback to savepoint a;
-- neq
select graphql.resolve($${accountCollection(filter: {id: {neq: 2}}) { edges { node { id } } }}$$);
resolve
Expand All @@ -157,6 +165,14 @@ begin;
{"data": {"accountCollection": {"edges": [{"node": {"id": 1}}]}}}
(1 row)

rollback to savepoint a;
-- lt - null - should be ignored
select graphql.resolve($${accountCollection(filter: {id: {lt: null}}) { edges { node { id } } }}$$);
resolve
-------------------------------------------------------------------------------------------------------------
{"data": {"accountCollection": {"edges": [{"node": {"id": 1}}, {"node": {"id": 2}}, {"node": {"id": 3}}]}}}
(1 row)

rollback to savepoint a;
-- lte
select graphql.resolve($${accountCollection(filter: {id: {lte: 2}}) { edges { node { id } } }}$$);
Expand Down
8 changes: 8 additions & 0 deletions test/sql/resolve_connection_filter.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ begin;
$$)
);

-- filter = null is ignored
select graphql.resolve($${accountCollection(filter: null) { edges { node { id } } }}$$);
rollback to savepoint a;

-- neq
select graphql.resolve($${accountCollection(filter: {id: {neq: 2}}) { edges { node { id } } }}$$);
rollback to savepoint a;
Expand All @@ -84,6 +88,10 @@ begin;
select graphql.resolve($${accountCollection(filter: {id: {lt: 2}}) { edges { node { id } } }}$$);
rollback to savepoint a;

-- lt - null - should be ignored
select graphql.resolve($${accountCollection(filter: {id: {lt: null}}) { edges { node { id } } }}$$);
rollback to savepoint a;

-- lte
select graphql.resolve($${accountCollection(filter: {id: {lte: 2}}) { edges { node { id } } }}$$);
rollback to savepoint a;
Expand Down

0 comments on commit 34cc266

Please sign in to comment.