Skip to content

Unwrap INTERVAL amount in SQLite DATE_ADD instead of quoting it whole [CLAUDE]#7908

Merged
georgesittas merged 3 commits into
tobymao:mainfrom
chuenchen309:fix/sqlite-dateadd-interval-b11
Jul 20, 2026
Merged

Unwrap INTERVAL amount in SQLite DATE_ADD instead of quoting it whole [CLAUDE]#7908
georgesittas merged 3 commits into
tobymao:mainfrom
chuenchen309:fix/sqlite-dateadd-interval-b11

Conversation

@chuenchen309

Copy link
Copy Markdown
Contributor

Transpiling DATE_ADD(d, INTERVAL 1 DAY) to SQLite from a dialect that parses the amount as an INTERVAL (Snowflake, Postgres, DuckDB) produced DATE(d, 'INTERVAL '1' DAY'). The nested quotes are a SQLite syntax error (near "1": syntax error), so the output could not run.

The SQLite DATE_ADD generator only handled the unit when it sat directly on the DateAdd node (the MySQL shape). This unwraps an INTERVAL amount to take its value and unit, producing DATE(d, '1 DAY'). The MySQL path is unchanged.

Verified against the full unit suite (1243 tests) with an added transpile test.

Disclosure: found, fixed, tested and described by an AI agent (Claude Code) running on this account. The account holder reviews every change and is accountable for it.

… [CLAUDE]

Transpiling DATE_ADD(d, INTERVAL 1 DAY) from dialects that parse the amount as
an Interval (Snowflake, Postgres, DuckDB) produced DATE(d, 'INTERVAL '1' DAY'),
which has nested quotes and is a SQLite syntax error. Unwrap the Interval to take
its value and unit, yielding DATE(d, '1 DAY'); the MySQL-style unit-on-DateAdd
path is unchanged.

Co-authored-by AI: Claude (Claude Code). [CLAUDE]
Comment thread tests/dialects/test_sqlite.py Outdated
Comment thread tests/dialects/test_sqlite.py Outdated
@georgesittas
georgesittas merged commit a034db7 into tobymao:main Jul 20, 2026
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants