7
应该如何格式化(CSV?)文本文件,以便可以将它导入(与COPY
?)到PostgreSQL(8.4)表的数组列中?将数据复制(导入)到PostgreSQL数组列
所给出的表testarray
:
Column | Type |
---------+-------------------------|
rundate | date |
runtype | integer |
raw | double precision[] |
labels | character varying(16)[] |
results | double precision[] |
outcome | character varying(8)[] |
和
COPY testarray from '/tmp/import.txt' CSV
既不import.txt
以下工作内容:
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'
请注意,这是*默认*格式,但你c选择重写默认的引用字符。 http://www.postgresql.org/docs/8.4/interactive/sql-copy.html – kgrittn