X
Xata3mo ago
Oreki

Cursor Pagination Broken

Hii, i am facing an error with cursor pagination where i get this error when i use the cursor to paginate through the after and before fields
cursor invalid: filter invalid: column [character-\u003eelement]: invalid identifier, column [character-\u003eelement]: invalid identifier, offset 10: invalid symbol [\], only alphanumerics and '-', '_', or '~' are allowed
cursor invalid: filter invalid: column [character-\u003eelement]: invalid identifier, column [character-\u003eelement]: invalid identifier, offset 10: invalid symbol [\], only alphanumerics and '-', '_', or '~' are allowed
this happens when i use filter on JSON nested key character->element
6 Replies
kostas
kostas3mo ago
Hi, indeed there is a bug with paginating queries with json filters. We added an internal issue and will follow up. As development is currently focused on Postgres compatibility and features rather than the REST API, I cannot provide an estimate for fixing the issue. As a workaround you can use SQL https://xata.io/docs/sdk/sql/overview with the xata.sql call in the SDK and paginate with OFFSET/LIMIT.
SELECT * FROM "tablename" WHERE (character->>'element') = 'value1' OFFSET 20 LIMIT 20;
SELECT * FROM "tablename" WHERE (character->>'element') = 'value1' OFFSET 20 LIMIT 20;
SQL over HTTP
How to access Xata using SQL directly over HTTP
kostas
kostas3mo ago
The SQL tab in the docs here provides an example statement as well : https://xata.io/docs/sdk/filtering#working-with-json-documents
Filtering records
Use the Xata SDK to filter across APIs for versatile functionality
Oreki
Oreki3mo ago
Ohh I can implement a workaround no worries, I'd rather not change complete pagination Just wanted to report this
kostas
kostas3mo ago
Absolutely thank you for raising this
Oreki
Oreki3mo ago
The reason I am in constant denial of using raw SQL query is because I love xata's cursor pagination, on subsequent calls to getPaginated passing cursor retrieves all the filters and sorting from initial query Makes it a breeze to paginate through Hii, I know this is not a priority but could someone from the team just send a message in this thread this whenever this is fixed? Thank you!
kostas
kostas3mo ago
Certainly, we've linked this thread to the internal issue so once that is addressed we will drop a note here 👍
Want results from more Discord servers?
Add your server