Upgrading couchbase caused issues with SATISFIES

Hi there today I upgraded my couchbase package and i run into the issue with query

“SELECT META().id FROM adminDB WHERE (type = 'conversation') AND ANY v in userRecipients SATISFIES ((LOWER(v.firstName) LIKE '%rado%' OR LOWER(v.lastName) LIKE '%rado%')) END”

In 3.2 it throws error

Error Domain=CouchbaseLite Code=23 “N1QL syntax error near character 170” UserInfo={NSLocalizedDescription=N1QL syntax error near character 170}

Does anybody run also into the issue?

Seems like SATISFIES has an extra, redundant, set of ().

Please try without them:
SELECT META().id FROM adminDB WHERE (type = 'conversation') AND ANY v in userRecipients SATISFIES (LOWER(v.firstName) LIKE '%rado%' OR LOWER(v.lastName) LIKE '%rado%') END

That shouldn’t be an error.

After some discussion, this might be a potential regression and we are currently investigating.

@RomYk97 Please let us know if the proposed change does work.

1 Like

Removing brackets helped but im not sure how do we create more complicated clauses if brackets are causing issue.
Thanks for help for me its sufficient

"SELECT META().id FROM adminDB WHERE type = 'file' AND ANY v in versions SATISFIES v.docGuid IN ('docGuidExample') END"

SATISFIES doesnt work with IN so we have to downgrade to 2.8 probably something happned with brackets inside SATISFIES

For this specific one, please try adding brackets to SATISFIES.

SELECT META().id FROM adminDB WHERE type = 'file' AND ANY v in versions SATISFIES (v.docGuid IN ('docGuidExample')) END.

I’ve created CBL-6245 to track this bug. At the moment, we believe this regression was firstly introduced in 3.1.7 and still investigating.

1 Like