Skip to content

Commit

Permalink
Enable querying of the geometry column even when strict mode is activ…
Browse files Browse the repository at this point in the history
…ated (#240)
  • Loading branch information
drnextgis authored Mar 11, 2024
1 parent e0b7de4 commit 3419101
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pgstac/sql/002b_cql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ BEGIN
FOR prop IN
SELECT DISTINCT p->>0
FROM jsonb_path_query(j, 'strict $.**.property') p
WHERE p->>0 NOT IN ('id', 'datetime', 'end_datetime', 'collection')
WHERE p->>0 NOT IN ('id', 'datetime', 'geometry', 'end_datetime', 'collection')
LOOP
IF (queryable(prop)).nulled_wrapper IS NULL THEN
RAISE EXCEPTION 'Term % is not found in queryables.', prop;
Expand Down
5 changes: 5 additions & 0 deletions src/pgstac/tests/pgtap/002a_queryables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ SELECT lives_ok(
'Make sure a term present in the list of queryables can be used in a filter'
);

SELECT lives_ok(
$$ SELECT search('{"filter": {"s_intersects": [{"property": "geometry"}, {"type": "Point", "coordinates": [0, 0]}]}}'); $$,
'Make sure a term present in the list of queryables can be used in a filter'
)

SELECT lives_ok(
$$ SELECT search('{"filter": {"and": [{"t_after": [{"property": "datetime"}, "2020-11-11T00:00:00"]}, {"t_before": [{"property": "datetime"}, "2022-11-11T00:00:00"]}]}}'); $$,
'Make sure that only arguments that are properties are checked'
Expand Down

0 comments on commit 3419101

Please sign in to comment.