Repository navigation
fix(find): refuse a cursor along an order with no comparable value - #1031
Merged
Merged
Conversation
A cursor pages along the values of the read's order, comparing each row's
value with the cursor's. A read ordered by an array attribute passed the
array the cursor holds to Query::greaterThan(), a TypeError, and one
ordered by a spatial attribute reached MySQL as a geometry comparison it
refuses with error 1210, both server errors. MongoDB, Memory and Redis
answered such a page, but by comparisons that do not follow the order, so
paging along it skipped or repeated rows. 7.4.2 failed the SQL engines the
same way ("Unknown PDO Type for array").
find() refuses a cursor along an array, object, spatial or vector
attribute as an invalid query on every adapter, under a join alias too.
Ordering by such an attribute without a cursor keeps working as it did.
The refusal is a plain query error rather than Exception\Order, which
consumers report as a null order value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Staging bug E: cursor paging over an array or spatial order gave a 500.
orderAscon a string-array (sa), int-array (ia), point (pt) or line (ln) column combined withcursorAfterfailed as follows:TypeError Query::greaterThan() given an arrayatSQL.php:5737(cursorConditions).PDOException 1210 Incorrect arguments to >.The same orders without a cursor return 200.
A cursor pages along the values of the read's order and compares each row's value with the cursor's. An array, object, spatial or vector attribute has no value an engine can compare that way. 7.4.2 failed here too ("Unknown PDO Type for array"). MongoDB, Memory and Redis did answer such a page, but with comparisons that do not follow the order, so paging along it skipped or repeated rows.
find()now refuses a cursor along an array, object, spatial or vector attribute withException\Queryon every adapter, including under a join alias. Ordering by such an attribute without a cursor keeps working exactly as on main, and so does a cursor along a scalar order. The refusal is a plain query error, notException\Order, because Appwrite reportsException\Orderasdatabase_query_order_null("had a null value").Behaviour change to note: on MongoDB, Memory and Redis, a cursor along an array or object order used to return a (mis-ordered) page and is now refused.
Regression tests
DocumentTests::testCursorAlongAnOrderWithoutComparableValuesIsAnInvalidQuery: orders bysa,ia, pluspt/lnwhere spatial,objwhere objects andvecwhere vectors; each with asc+after, desc+after, asc+before, and behind a scalar order; the same orders without a cursor still return every row; a cursor alongnstill pagesTypeError: Query::greaterThan(): Argument #2 ($value) must be of type string|int|float|bool, array givenatSQL.php:5737saacceptedRun locally against Docker: the full adapter suites for MySQL, MariaDB, Postgres, SQLite, MongoDB, Memory and Redis pass, as do the full unit suite, Pint and PHPStan.
API repro (Appwrite)
GET /v1/tablesdb/{db}/tables/{t}/rows?queries[]={"method":"orderAsc","attribute":"sa"}&queries[]={"method":"cursorAfter","values":["<rowId>"]}→400 general_query_invalid, messageCannot page with a cursor along the order of 'sa': an array, object, spatial or vector attribute has no value a cursor can compare(was 500). The same holds foria,ptandln, and fororderDescandcursorBefore. Without the cursor query →200.🤖 Generated with Claude Code