Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination error #177

Closed
gadomski opened this issue Apr 24, 2023 · 1 comment · Fixed by #178
Closed

Pagination error #177

gadomski opened this issue Apr 24, 2023 · 1 comment · Fixed by #178
Assignees
Labels
bug Something isn't working

Comments

@gadomski
Copy link
Member

Originally discovered here, pagination appears to be broken in v0.7.4. Things work ok in v0.7.3. Minimum reproducible example (a simple test in 004_search.sql):

diff --git a/src/pgstac/tests/pgtap/004_search.sql b/src/pgstac/tests/pgtap/004_search.sql
index 85d15e4..acc6d3a 100644
--- a/src/pgstac/tests/pgtap/004_search.sql
+++ b/src/pgstac/tests/pgtap/004_search.sql
@@ -68,6 +68,10 @@ SELECT results_eq($$
 );
 
 
+SELECT search('{"collections": ["pgstac-test-collection"], "limit": 1}');
+SELECT search('{"collections": ["pgstac-test-collection"], "limit": 1, "token": "next:pgstac-test-item-0001"}');
+
+
 SELECT has_function('pgstac'::name, 'search_query', ARRAY['jsonb','boolean','jsonb']);

fails with

psql:tests/pgtap/004_search.sql:72: ERROR:  syntax error at or near ")"
LINE 1: ...WHERE collection = ANY ('{pgstac-test-collection}')  AND ();
                                                                     ^
QUERY:  EXPLAIN (format json) SELECT 1 FROM items WHERE collection = ANY ('{pgstac-test-collection}')  AND ();
CONTEXT:  PL/pgSQL function chunker(text) line 8 at EXECUTE
PL/pgSQL function search_rows(text,text,text[],integer) line 25 at FOR over SELECT rows
SQL statement "SELECT jsonb_agg(format_item(i, _fields, hydrate))                      FROM search_rows(
        full_where,
        orderby,
        search_where.partitions,
        _querylimit
    ) as i"
PL/pgSQL function search(jsonb) line 66 at SQL statement
@gadomski gadomski added the bug Something isn't working label Apr 24, 2023
@bitner
Copy link
Collaborator

bitner commented Apr 24, 2023

This search against the test database confirms this bug. select * from search('{"token":"next:pgstac-test-item-0001","limit":1,"sortby":[{"field":"datetime", "direction":"asc"}]}');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants