Skip to content

SQLiteDialect rejects unquoted boolean keywords in both the assignment and parenthesized forms of PRAGMA. #3036

Open

Description

@lei-jia-xing

Reproduction

With sqlparser = "=0.64.0":

use sqlparser::{dialect::SQLiteDialect, parser::Parser};

fn main() {
    for sql in [
        "PRAGMA recursive_triggers = true;",
        "PRAGMA foreign_keys(ON);",
    ] {
        match Parser::parse_sql(&SQLiteDialect {}, sql) {
            Ok(statements) => println!("{statements:?}"),
            Err(error) => println!("{error}"),
        }
    }
}

Actual behavior

sql parser error: Expected: number or string or ? placeholder, found: true at Line: 1, Column: 29
sql parser error: Expected: a concrete value, found: ON at Line: 1, Column: 21

Expected behavior

Parse both statements as Statement::Pragma with a value. SQLite allows unquoted boolean arguments such as ON, OFF, TRUE, and FALSE in both forms. I verified both examples on SQLite 3.53.3. Querying each setting after the assignment returned 1.

SQLite PRAGMA command syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions