Skip to content

SQLite 2.3.0 - DELETE with Subquery returns [SQL error: parser stack overflow] #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
genotix opened this issue Jan 27, 2021 · 3 comments

Comments

@genotix
Copy link

genotix commented Jan 27, 2021

Hi,

I've been trying to execute a DELETE to clean up a single table which fails with error: SQL error: parser stack overflow
My device is an ESP32-WROVER-B (TTGO T-CALL v1.4 to be exact) and I'm using the SPIFFS library without any SD card.

The snippet of code responsible for the delete action:
sql = F("DELETE FROM raw_log WHERE rowid IN (SELECT rowid FROM raw_log limit 20 ASC);"); // Remove oldest first int rc = db_exec(db1, sql.c_str() ); if (rc != SQLITE_OK) { sqlite3_close(db1); return; } vacuum();

The table structure:
CREATE TABLE IF NOT EXISTS raw_log (reg DATETIME, transmitted BOOL, content BLOB);

Any hints on what I'm doing wrong would be appreciated.
(I know could execute the the select separately and run a loop to delete per record and would expect this to work but I rather have clean code if possible; SQLite seems to be -very- complete given the lightweight system it is running on).

@Dhruvan1
Copy link

Hi,

I've been trying to execute a DELETE to clean up a single table which fails with error: SQL error: parser stack overflow My device is an ESP32-WROVER-B (TTGO T-CALL v1.4 to be exact) and I'm using the SPIFFS library without any SD card.

The snippet of code responsible for the delete action: sql = F("DELETE FROM raw_log WHERE rowid IN (SELECT rowid FROM raw_log limit 20 ASC);"); // Remove oldest first int rc = db_exec(db1, sql.c_str() ); if (rc != SQLITE_OK) { sqlite3_close(db1); return; } vacuum();

The table structure: CREATE TABLE IF NOT EXISTS raw_log (reg DATETIME, transmitted BOOL, content BLOB);

Any hints on what I'm doing wrong would be appreciated. (I know could execute the the select separately and run a loop to delete per record and would expect this to work but I rather have clean code if possible; SQLite seems to be -very- complete given the lightweight system it is running on).

facing same issue

@siara-cc
Copy link
Owner

Hi, please see this. I think vacuum is causing this issue. I am not sure if there is a simple solution. Best solution I can think of is to maintain periodical logs and delete the old files.
#50 (comment)

@siara-cc
Copy link
Owner

Also #43 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants