I want to export a reference table from a development environment and import it into the production database.
When I export a TEXT field that contains a string that can be interpreted as a number it is exported without quotation marks. Unfortunately that means that leading '0' characters are lost when I execute the resulting SQL to import it again. The string is changed.
Example of an exported table below. Note: the sensor_id column is TEXT and the value in the first row is '0000000000000001', but during the export the quotation marks are lost and during a subsequent import (executing the SQL) the value changes to '1', which is a very different string. The second row works fine, since it has the string '28C078480500001B' properly within quotation marks.
CREATE TABLE "sensor_descr" (
sensor_id TEXT,
sensor_descr TEXT,
sensor_nick TEXT
);
INSERT INTO sensor_descr VALUES(0000000000000001,'Broken Example','broken');
INSERT INTO sensor_descr VALUES('28C078480500001B','Working Example','works');
COMMIT;
This problem occurs both in version 3.0.2 that is available in the OpenSuse repository and in the latest source downloaded and compiled from scratch just now (23rd Oct 2014).
Reactions are currently unavailable
I want to export a reference table from a development environment and import it into the production database.
When I export a TEXT field that contains a string that can be interpreted as a number it is exported without quotation marks. Unfortunately that means that leading '0' characters are lost when I execute the resulting SQL to import it again. The string is changed.
Example of an exported table below. Note: the sensor_id column is TEXT and the value in the first row is '0000000000000001', but during the export the quotation marks are lost and during a subsequent import (executing the SQL) the value changes to '1', which is a very different string. The second row works fine, since it has the string '28C078480500001B' properly within quotation marks.
CREATE TABLE "sensor_descr" (
sensor_id TEXT,
sensor_descr TEXT,
sensor_nick TEXT
);
INSERT INTO sensor_descr VALUES(0000000000000001,'Broken Example','broken');
INSERT INTO sensor_descr VALUES('28C078480500001B','Working Example','works');
COMMIT;
This problem occurs both in version 3.0.2 that is available in the OpenSuse repository and in the latest source downloaded and compiled from scratch just now (23rd Oct 2014).