Python3 | SQL 请求失败

Python3 | SQL request failed

所以。简单请求 SELECT * FROM access WHERE {arg}=TRUE,其中 arg = "friends_grinder".

File "/root/python/NaVK/source/main/FriendsGrinderEngine.py", line 51, in __routine
    users = ADB.get_authorized_users('friends_grinder')
  File "/root/python/NaVK/source/database/AccessDB.py", line 30, in get_authorized_users
    users = self.__conn.cursor().execute(f'SELECT * FROM access WHERE {arg}=TRUE').fetchall()
sqlite3.OperationalError: no such column: TRUE

我在 windows 上没有收到此错误。但我在 Ubuntu.
上看到了 friends_grinder 列是 BOOLEAN

来自the documentation

Beginning with SQLite 3.23.0 (2018-04-02), SQLite recognizes the identifiers "TRUE" and "FALSE" as boolean literals, if and only if those identifiers are not already used for some other meaning. If there already exists columns or tables or other objects named TRUE or FALSE, then for the sake of backwards compatibility, the TRUE and FALSE identifiers refer to those other objects, not to the boolean values.

The boolean identifiers TRUE and FALSE are usually just aliases for the integer values 1 and 0, respectively. However, if TRUE or FALSE occur on the right-hand side of an IS operator, then they form new unary postfix operators "IS TRUE" and "IS FALSE" which test the boolean value of the operand on the left.

如果您得到 no such column: TRUE 作为错误,这意味着该系统上使用的 sqlite 版本太旧而无法识别标识符。升级,或改用 1