Skip to content

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

@vanbastun

Description

@vanbastun

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions