xnuinside / simple-ddl-parser

Simple DDL Parser to parse SQL (HQL, TSQL, AWS Redshift, BigQuery, Snowflake and other dialects) ddl files to json/python dict with full information about columns: types, defaults, primary keys, etc. & table properties, types, domains, etc.
MIT License
175 stars 40 forks source link

Case Statement in postgresql not supported #267

Open erwin-frohsinn opened 3 weeks ago

erwin-frohsinn commented 3 weeks ago

Describe the bug The following is not parsed. Seems that the "case" statement is not supported.

create table pole.t_spiel (
    id               varchar(10)               not null
        constraint t_spiel_pk
            primary key,
    v_id             varchar(10) generated always as (
        CASE
            WHEN ((id)::text ~ '^\d+$'::text) THEN (lpad((id)::text, 2, '0'::text))::character varying
            ELSE id
            END) stored
);

To Reproduce Steps to reproduce the behavior: Parse with simple_ddl_parser

Desktop (please complete the following information):