How should a (CSV?) text file be formatted so that it can be imported (with COPY
?) into an array column in a PostgreSQL (8.4) table?
Given table testarray
:
Column | Type |
---------+-------------------------|
rundate | date |
runtype | integer |
raw | double precision[] |
labels | character varying(16)[] |
results | double precision[] |
outcome | character varying(8)[] |
and
COPY testarray from '/tmp/import.txt' CSV
neither of the following contents of import.txt
work:
2010/06/22,88,{{1,2},{3,4}},{{1,2},{3,4}},{{1,2},{3,4}},{{1,2},{3,4}}
2010/06/22,88,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4
2010/06/22,88,'{{1,2},{3,4}}','{{1,2},{3,4}}','{{1,2},{3,4}}','{{1,2},{3,4}}'
2010/06/22,88,'1,2,3,4','1,2,3,4','1,2,3,4','1,2,3,4'
COPY testarray from '/tmp/import.txt' CSV
2010-06-22,88,"{{1,2},{3,4}}","{{1,2},{3,4}}","{{1,2},{3,4}}","{{1,2},{3,4}}"