Skip to content

A parsing error that occurred on sqlite3 for "NOT NULL ORDER BY 1;" expression. #6334

@VLDB2026

Description

@VLDB2026

Fully reproducible code snippet

When I'm trying to parse the query below, a ParseError occurs:

import sqlglot
query = """SELECT a , b  FROM t1 WHERE b+a NOT NULL ORDER BY 1;"""
sqlglot.parse_one(query, read="sqlite")

error messages:

sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 1, Col: 40.
  SELECT a , b  FROM t1 WHERE b+a NOT NULL ORDER BY 1;

Additional messages

When I execute the following statement on sqlite3:

CREATE TABLE t1(a,b,c,d);
CREATE TABLE t2(e, f);
SELECT a , b  FROM t1 WHERE b+a NOT NULL ORDER BY 1;

It can be executed normally.

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