Don't fail on empty column "type"
drzraf opened this issue · comments
Describe the bug
In SQLite, the column "affinity" can be omitted. Eg (here the size
)
sqlite> pragma table_info(x);
[...]
23|foo|INT|0||0
24|size||0||0
25|bar|TEXT|0||0
[...]
or
CREATE TABLE x (foo int, size, bar text
Expected behaviour
Either guess the data-type based on the following insert, either assumed INT, either make it configurable.
In any case, the output should be more explicit, like
Unspecified column_type for table "x". Guessed: "INT"
Unspecified column_type for table "x". Using user-choice: "VARCHAR"
Actual result
Invalid column_type
System Information
$ sqlite3mysql --version
1.4.16
Even though SQLite type affinities are recommended and not required, I do believe that it's up to the user to keep their data in order. Guessing a datatype is way out of scope here and using a default, i.e. VARCHAR(255)
, might introduce issues further down the line.
I will treat this as an edge case which can be easily solved by the user manipulating their original SQLite data.
In any case, I'm happy for you to submit a PR.