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

Fail to parse Postgres CREATE TABLE statement with GENERATED ALWAYS AS IDENTITY(INCREMENT BY 1...)

Open vanbastun opened this issue 1 year ago • 1 comments

Hello.

To Reproduce ddl = """CREATE TABLE IF NOT EXISTS public.generator_id ( hall_id int4 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START 1 CACHE 1 NO CYCLE) NOT NULL, hall_name varchar(50) NOT NULL, CONSTRAINT hall_pkey PRIMARY KEY (hall_id)); ""

parse_results = DDLParser(ddl, silent=False, log_file='parser19052.log', log_level=logging.DEBUG).run()

Error 1: simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(BY,'BY',1,105) if delete the word 'BY' after 'INCREMENT' Error 2: simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(NO,'NO',1,154)

Expected behavior parsed output

Desktop (please complete the following information):

  • OS: [Windows10]
  • Python 3.11.5
  • simple_ddl_parser 1.3.0

Additional context log_file='parser19052.log' log file was created but was empty and never was populated.

Thank You!

vanbastun avatar May 19 '24 14:05 vanbastun

@vanbastun thanks for opening the issue, I will check!

xnuinside avatar May 19 '24 14:05 xnuinside