drawdb icon indicating copy to clipboard operation
drawdb copied to clipboard

Import from SQL: postgresql default type can't be parsed

Open krhubert opened this issue 1 year ago • 2 comments

It is not possible to import postgresql schema with defaults and type casting into drawDB.

Steps to reproduce

Choose a database -> PostgreSQL -> Go to File -> Import from SQL -> upload SQL schema -> Click import

Schema file:

CREATE SCHEMA public;

CREATE TABLE public.tok1 (
    description text NOT NULL
);

CREATE TABLE public.tok2 (
    description text default '' NOT NULL
);

CREATE TABLE public.tnotok (
    description text DEFAULT ''::text NOT NULL
);

Error

SyntaxError [Ln 12, Col 32]: Expected ")", ",", "--", "/*", "AUTO_INCREMENT", "CHARACTER", "COLLATE", "COLUMN_FORMAT", "COMMENT", "DEFAULT", "KEY", "NOT NULL", "NULL", "ON", "PRIMARY", "REFERENCES", "STORAGE", "UNIQUE", [ \t\n\r], or [\n] but ":" found.

Expected behaviour

Import flow completes without errors.

krhubert avatar Jul 23 '24 08:07 krhubert

Hey! Thanks for reporting.

The parser fails on ':'. I just created an issue in the parser repository. Hopefully it will be supported soon.

1ilit avatar Jul 23 '24 09:07 1ilit

I'm having the same problem, but I just saw that the docker image tag I'm using xinsodev/drawdb:latest was built before the problem was fixed. Will a new version be built soon?

Paulpatou avatar Oct 21 '24 14:10 Paulpatou