simple-ddl-parser icon indicating copy to clipboard operation
simple-ddl-parser copied to clipboard

GENERATED BY DEFAULT and CONSTRAINT with CHECK

Open erwin-frohsinn opened this issue 1 year ago • 1 comments

Describe the bug The following is not parsed:

CREATE TABLE pole.t_zuschauer (
	id int4 GENERATED BY DEFAULT AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START 1 CACHE 1 NO CYCLE) NOT NULL, -- Zuschauer-Nr.(Primärschlüssel)
	email varchar(50) NULL, -- email-Adresse
	CONSTRAINT t_zuschauer_email CHECK (((email IS NULL) OR ((email)::text = ''::text) OR ((email)::text ~* '([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+)\.[a-zA-Z]{2,}'::text))),
	CONSTRAINT t_zuschauer_id PRIMARY KEY (id)
);

To Reproduce Parse with simple_ddl_parser

Desktop (please complete the following information):

  • OS: Kubuntu
  • Python 3.12
  • Postgres

Probable causes: id contains valid ddl code but prevents the columns from being parsed the constraint which checks the the email is not accepted

erwin-frohsinn avatar Jul 07 '24 09:07 erwin-frohsinn