8000 SQLite parse error for triggers with INSERTs · Issue #6965 · sqlfluff/sqlfluff · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
SQLite parse error for triggers with INSERTs #6965
Open
@Hendrikto

Description

@Hendrikto

Search before asking

  • I searched the issues and found no similar issues.

What Happened

I tried to lint a valid SQLite CREATE TRIGGER statement, but got a parsing error.

Expected Behaviour

The CREATE TRIGGER statement is valid (see https://sqlite.org/lang_createtrigger.html) and accepted without problems by SQLite (tested with 3.50.1), so Sqlfluff should parse and lint it.

Observed Behaviour

Sqlfluff fails to parse the statement, giving a PRS error (see below).

How to reproduce

❯ cat sqfluff_repro.sql 
CREATE TRIGGER trigger_name
AFTER UPDATE ON table_name
BEGIN
    INSERT INTO table_name_history (action) VALUES ('UPDATE');
END;
❯ sqlfluff lint --dialect=sqlite sqfluff_repro.sql
== [sqfluff_repro.sql] FAIL                                                                                                  
L:   1 | P:   1 |  PRS | Line 1, Position 1: Found unparsable section: 'CREATE
                       | TRIGGER trigger_name\nAFTER UPDATE...'
WARNING: Parsing errors found and dialect is set to 'sqlite'. Have you configured your dialect correctly?
All Finished 📜 🎉!

Note: Using SELECT 1; instead of the INSERT statement parses just fine:

❯ cat sqfluff_repro2.sql 
CREATE TRIGGER trigger_name
AFTER UPDATE ON table_name
BEGIN
    SELECT 1;
END;
❯ sqlfluff lint --dialect=sqlite sqfluff_repro2.sql
== [sqfluff_repro2.sql] FAIL                                                                                                  
L:   4 | P:   1 | LT02 | Line should not be indented. [layout.indent]
All Finished 📜 🎉!

Dialect

SQLite

Version

❯ python --version
Python 3.13.3
❯ sqlfluff --version
sqlfluff, version 3.4.1
❯ sqlite3 --version
3.50.1 2025-06-06 14:52:32 b77dc5e0f596d2140d9ac682b2893ff65d3a4140aa86067a3efebe29dc91alt1 (64-bit)

Configuration

I am using the default configuration.

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsqliteIssues or enhancements to SQLite dialect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0