purcell / sqlint

Simple SQL linter supporting ANSI and PostgreSQL syntaxes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generated column syntax from postgresql 12 detected as error

abeluck opened this issue · comments

docs: https://www.postgresql.org/docs/12/ddl-generated-columns.html

Example (from the docs above):

CREATE TABLE people (
    height_cm numeric,
    height_in numeric GENERATED ALWAYS AS (height_cm / 2.54) STORED
);
$ sqlint test.sql
test.sql:3:43:ERROR syntax error at or near "("

It is curious that this is happening because I thought sqlint used psql as the parser.

This should be fixed now, with release 0.1.10.

Well, to be fair: I haven't tested this yet, but what I have done is update to the latest pg_query gem, which is where the specific support for syntax comes from.

Yeah, doesn't look like pg_query has been updated for PG 12 syntax. :-(

The blocker is upstream in libpg_query, but there's a PR open for PG 12 compatibility: pganalyze/libpg_query#62