Skip to content

Sqlite "RETURNING" clause not supported by most Android "native" SQLite versions #860

@err0r500

Description

@err0r500

Hi,

Electric (react-native ?) client's code makes use of the "RETURNING" clause in the SQLite queries.
This "clause" is supported in SQLite 3.35.0 and above (https://www.sqlite.org/lang_returning.html) the issue is that these versions of SQLite are not supported before API 34 of Android (https://developer.android.com/reference/android/database/sqlite/package-summary) which means less that 5% of the Android market share (https://gs.statcounter.com/os-version-market-share/android).

Issue Reproduction

As an example, testing the provided react-native application with a Pixel 5 (API 33) fails at startup with a

Object {
  "code": 0,
  "message": "near \"RETURNING\": syntax error (code 1 SQLITE_ERROR): , while compiling: UPDATE main._electric_oplog SET timestamp = ?
      WHERE rowid in (
        SELECT rowid FROM main._electric_oplog
            WHERE timestamp is NULL
        ORDER BY rowid ASC
        )
      RETURNING *",
}

this issue is not encountered when :

  • running this query without the RETURNING clause
  • running on a Pixel 6 (API 34).

Possible fixes

I guess there are 2 ways of fixing this problem :

  1. remove the RETURNING clauses
  2. use a SQLite "driver" lib that ships with its own SQLite (in a supported version), like

Do I miss something or are there something planned about this ? (I'd happily make a new adapter for react-native-quick-sqlite)

Best,
Matthieu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions