GRDB on MacCatalyst - SQL Select works on iPad not on Mac for same DB

Hi,
We have ported an iPad app which runs well using GRDB on a SQLCipher database. When we run on a Mac the exact same database (even MD5 checked for binary compatibility) has issues with SQL queries that run fine on iPad. Are there any limitations on SQL usage when run on Catalyst we shouold be aware of ? One of the issues we worked around for one query involved the uses of aliases in the query for legibility. Reverting to the base table column name resolved it.

Anybody seen this before ?

Thanks

Hello @TenMoons,

I didn't myself run any similar setup, and you are the first reporting such an issue.

What I do not understand in your report is that the same SQLCipher version parses the same SQL query differently on iPad or on Catalyst. That's quite weird. SQLite is very unlikely to exhibit such variation, and I don't imagine the SQLCipher variation to significantly affect the SQL parser.

I would thus look elsewhere.

For example, a frequent problem is linking two distinct SQLite versions in the same app (both SQLCipher and the stock SQLite, for example). Since both libs define the same symbols, odd things can happen.

Maybe look in this direction, and generally question your assumptions.

And for further help, a much more detailed report will be needed. Ideally, the detailed report would include a minimal reproducible case.

Hi Gwendal,
yes, I found it strange myself, but the same database, loaded with the same test data is used in the iPad deployment and in the Mac Catalyst deployment. The same SQL is used for both cases. There is no compile time split for Catalyst. So same data, same SQL, same database.
Is it possible that at lower levels a Catalyst app may remap incorrectly between String, NSString and C String when the cleartext SQL is used in the SQLite prepare ?

The app links in the GRDB and SQLCipher Pods but we do not link any other SQLite libs. We also do not import any SQLite libs at a system level but we will check.

One final question here. We have our primary indexes on the tables identified as a column called _id rather than a more normal column called id. Is there any reason the underscore might cause an issue ?
I cant seem to find anything related to underscores in the SQL standard. I wondered if a Mac SQLite handler treated it differently to an iOS handler.

Thanks for the pointers which we will investigate.

Paul

Is it possible that at lower levels a Catalyst app may remap incorrectly between String, NSString and C String when the cleartext SQL is used in the SQLite prepare ?

I hope not :sweat_smile:

The app links in the GRDB and SQLCipher Pods but we do not link any other SQLite libs. We also do not import any SQLite libs at a system level but we will check.

The system SQLite can be used by other third-party libraries (analytics, whatever) indeed.

One final question here. We have our primary indexes on the tables identified as a column called _id rather than a more normal column called id. Is there any reason the underscore might cause an issue ?

None that I'm aware of. There is this special rowid column that can be spelled rowid, oid, or _rowid_. But _id is not one of its alternate names.

Terms of Service

Privacy Policy

Cookie Policy