Skip to content

Trino grammar error on CREATE TABLE (PRIMARY keyword not found) #6785

@humpfhumpf

Description

@humpfhumpf

Search before asking

  • I searched the issues and found no similar issues.

What Happened

Lint failed, whatever the CREATE TABLE statement is, with trino dialect.

Expected Behaviour

Lint should validate CREATE TABLE statements.

Observed Behaviour

The error message says: Grammar refers to the 'PRIMARY' keyword which was not found in the trino dialect.

==== sqlfluff ====
sqlfluff:                3.3.1 python:                 3.12.2
implementation:        cpython verbosity:                   1
dialect:                 trino templater:               jinja
rules:                                all
==== readout ====

WARNING    Unable to lint test.sql due to an internal error. Please report this as an issue with your query's contents and stacktrace below!       
To hide this warning, add the failing file to .sqlfluffignore
RuntimeError: Grammar refers to the 'PRIMARY' keyword which was not found in the trino dialect.

The syntax in the query is not (yet?) supported. Try to narrow down your query to a minimal, reproducible case and raise an issue on GitHub.        

Or, even better, see this guide on how to help contribute keyword and/or dialect updates:
https://docs.sqlfluff.com/en/stable/perma/contribute_dialect_keywords.html
 
==== summary ====
violations:        0 status:         PASS

How to reproduce

This simple CREATE TABLE statement raises the error:

CREATE TABLE a (
    str varchar
);

.sqlfluff config file:

[sqlfluff]
dialect = trino

sqlfluff command (on Windows):
python.exe -m sqlfluff lint --config ..\..\..\.sqlfluff -v .\test.sql

Dialect

trino

Version

3.3.1

Configuration

[sqlfluff]
dialect = trino

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 workingtrino

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions