Skip to content

Error while enabling compression for some field, saying dict chooser expression invalid #45

@renyuneyun

Description

@renyuneyun

I'm trying to enable compression for my sqlite database, following the README. I have several columns to compress. Executing SELECT zstd_enable_transparent(...); works fine for the first statement, but fails any further ones, with the following error:

sqlite> SELECT zstd_enable_transparent('{"table": "queryrecord", "column": "system_message", "compression_level": 19, "dict_chooser": "''a''"}');
[2024-09-27T22:40:29Z WARN  sqlite_zstd::transparent] Warning: It is recommended to set `pragma journal_mode=WAL;`
[2024-09-27T22:40:29Z WARN  sqlite_zstd::transparent] Warning: It is recommended to set `pragma auto_vacuum=full;`
[2024-09-27T22:40:29Z WARN  sqlite_zstd::transparent] Warning: It is recommended to set `pragma busy_timeout=2000;` or higher
Runtime error: Dict chooser expression does not seem to be valid. Make sure you return a string and get your escaping right: If you want an sqlite string inside a json string inside a sqlite string you need to do '{"foo": "''bar''"}'

Caused by:
    0: Tried to execute:
       select ('a') as dict_chooser from `queryrecord` limit 1
    1: unsafe use of zstd_decompress_col()
    2: Error code 1: SQL error or missing database
sqlite> select ('a') as dict_chooser from `queryrecord` limit 1

It happens as well if I try to execute multiple statements at once, connected by ,, as illustrated in the README.

Any ideas why this happens?

(I'm not an experienced sqlite user, so I may miss something obvious. Please do let me know if that's the case.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions