Last active
September 20, 2016 08:08
-
-
Save rollxx/edcab2a060af1040bc1af30f78de0cfe to your computer and use it in GitHub Desktop.
import allocation with extra temporal table to filter out the unneeded fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMPORARY TABLE t ( | |
location VARCHAR(255), | |
car_group_id SERIAL8, | |
start_timestamp TIMESTAMP WITH TIME ZONE, | |
end_timestamp TIMESTAMP WITH TIME ZONE, | |
ignore1 TEXT, | |
ignore2 TEXT, | |
ignore3 TEXT | |
); | |
COPY t (location, car_group_id, start_timestamp, end_timestamp, ignore1, ignore2, ignore3) | |
FROM E'D:\\zz.csv' DELIMITER ';' CSV HEADER; | |
INSERT INTO allocations (fromtimestamp, totimestamp, cargroup_id, repairsite_id, version) | |
SELECT | |
start_timestamp, | |
end_timestamp, | |
car_group_id, | |
1, | |
0 | |
FROM t; | |
DROP TABLE t; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment