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
\set file_path '/home/user/sql/' | |
\set sq '\'' | |
\set file :sq:file_path:file_name:sq | |
\set command '\\copy tmp from ' :file ' delimiter ':sq',':sq ' csv header;' | |
create temp table tmp ( | |
aaa integer | |
, bbb varchar | |
, ccc varchar | |
); | |
:command | |
INSERT INTO test_table ( | |
aaa | |
, bbb | |
, ccc | |
, create_datetime | |
, update_datetime | |
) | |
SELECT | |
tmp.aaa | |
, tmp.bbb | |
, tmp.ccc | |
, current_timestamp | |
, current_timestamp | |
FROM tmp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment