astro-datalab / fits2db

2 stars 3 forks source link

Can not insert a CSV with an array column #10

Open iglesu opened 1 year ago

iglesu commented 1 year ago

It seems having the same delimiter for columns and the elements of the array confuses the Postgres copy command. One solution I found was to set the delimiter to something else, e.g. | and leave the delimiter for the array to be comma separated.

iglesu commented 1 year ago

A better solution is to simply quote the array: E.g. COPY mydb_3195.test_qm_import_fits (targetid,targetcode,fluxarray) FROM stdin CSV DELIMITER ','; 19722,ABCD,"{{24.82,5.42},{0.10,14.04}}" 75828,ABC,"{{514.06,60.03},{82.43,19.31}}"