Skip to content

Parser skips tables containing 'REFERENCES' and 'NOT NULL' #239

@Nerwerder

Description

@Nerwerder

Describe the bug

Calling 'parse_from_file' on a file containing (postgres) sql 'create table' instructions will not return tables containing a column using 'REFERENCES' and 'NOT NULL'.

To Reproduce

Good case:

CREATE TABLE a
(
    id UUID PRIMARY KEY
);

CREATE TABLE b
(
    id UUID PRIMARY KEY,
    a_id UUID REFERENCES a(id)
);

=> Will return two tables.

Bad case:

CREATE TABLE a
(
    id UUID PRIMARY KEY
);

CREATE TABLE b
(
    id UUID PRIMARY KEY,
    a_id UUID REFERENCES a(id) NOT NULL
);

=> Will only return a single table (a).

Expected behavior

All tables should be returned.

Environment:

  • Ubuntu 23.10
  • Python 3.12.0
  • simple-ddl-parser 1.0.3

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions