pgloader/test/dbf.load
Dimitri Fontaine 39fc78e08f Implement user-defined casting rules support for DB3.
The casting support for DB3 was hand-crafted and didn't get upgraded to
using the current CAST grammar and facilities, for no other reasons than
lack of time and interest. It so happens what implementing it now fixes two
bug reports.

Bug #938 is about conversion defaulting to "not null" column, and that's due
to the usage of the internal pgloader catalogs where the target column's
nullable field is NIL by default, which doesn't make much sense. With
support for user-defined casting rules, the default is nullable columns, so
that's kind of a free fix.

Fixes #927.
Fixes #938.
2019-04-14 21:46:04 +02:00

13 lines
362 B
Fish

/*
* The file comes from:
*
* http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/reg2013.dbf
*/
LOAD DBF
FROM data/reg2013.dbf with encoding cp850
INTO postgresql:///pgloader?public.reg2013
WITH truncate, create table, disable triggers
CAST column reg2013.region to integer,
column reg2013.tncc to smallint;