[ScanTool] Allow fallback converter (or type) for non registered types
docteurklein opened this issue · 5 comments
I just encoutered the problem when using this example pg database: http://pgfoundry.org/frs/shownotes.php?release_id=998
What could be the best idea ?:
- get a fallback type or converter fo things like (ENUM, tsvector, ...)
- force people to define converters and types for all non standard types of their schema
Fallback would be the treat them like VARCHAR. This would work well with enumerated types but maybe not with tsvector. I have to think what to do with such type.
ScanTool should be able to be STRICT, like it is now to make people able to detect missing converters or FRIENDLY to default any unknown type to TEXT.
After I successfuly import the Pagila database, I think I prefer sticking with the STRICT behavior, because
- there aren't that much types you link with String converter
- you must know when a new type is declared and the converter is being "forgotten"
- I think ENUMs should have their own converter
- Setting a default fallback makes things a lot more complicated imho
- and more generally because SQL is strongly typed and so we must tell PHP what to do in each case
What do you think ?
Yep, there is no good solution as there is not default type fallback that will work in most of the cases.
It's up to the user to register the good converters.
Concerning ENUMS, do you want to provide a default Enum Converter, or do you let users implement them?
In fact, I wish I could add a default ENUM type that would read its values from the database (table pg_enum is hidden in the schema pg_catalog) but I am still wondering the best way to do that (if there is any).