COPY可以跳过列吗? [英] Can COPY skip columns?
问题描述
COPY命令是否可以从文件中读取数据,但是跳过
具体列?
谢谢
Adam
-
此消息已被删除通过MailScanner扫描病毒和
危险内容,并且
被认为是干净的。
---------- -----------------(广播结束)---------------------------
提示7:别忘了增加你的免费空间地图设置
Hi,
Is it possible for the COPY command to read data from a file, but skip
specific columns?
Thanks
Adam
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
---------------------------(end of broadcast)---------------------------
TIP 7: don''t forget to increase your free space map settings
推荐答案
Adam Witney写道:
Adam Witney wrote:
COPY命令是否可以从文件中读取数据,但跳过特定的列?
\h复制
COPY tablename [(列[,...])]
TO {''filename''| STDOUT}
[[WITH]
[BINARY]
[OIDS]
[DELIMITER [AS]' 'delimiter'']
[NULL [AS]''null string'']
[CSV [QUOTE [AS]''quote'']
[ESCAPE [AS]''逃生'']
[FORCE QUOTE专栏[,...]]
是..你只需指定列...
此致,
Joshua D. Drake
>谢谢
Adam
Hi,
Is it possible for the COPY command to read data from a file, but skip
specific columns?
\h copy
COPY tablename [ ( column [, ...] ) ]
TO { ''filename'' | STDOUT }
[ [ WITH ]
[ BINARY ]
[ OIDS ]
[ DELIMITER [ AS ] ''delimiter'' ]
[ NULL [ AS ] ''null string'' ]
[ CSV [ QUOTE [ AS ] ''quote'' ]
[ ESCAPE [ AS ] ''escape'' ]
[ FORCE QUOTE column [, ...] ]
Yes.. you just have to specify the columns...
Sincerely,
Joshua D. Drake
Thanks
Adam
-
命令提示,Inc。,PostgreSQL复制的主页,以及plPHP 。
Postgresql支持,编程共享主机和专用主机。
+ 1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator。 PostgreSQL的集成复制
---------------------------(广播结束)------ ---------------------
提示8:解释分析是你的朋友
--
Command Prompt, Inc., home of PostgreSQL Replication, and plPHP.
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
Adam Witney< aw ***** @ sghms.ac.uk>写道:
Adam Witney <aw*****@sghms.ac.uk> writes:
COPY命令是否可以从文件中读取数据,但是跳过
特定的列?
Is it possible for the COPY command to read data from a file, but skip
specific columns?
Nope 。当您对输入数据进行重要的按摩时,通常最好的选择是将COPY复制到一个临时表中,该表与数据文件的格式完全匹配,然后是使用
INSERT / SELECT进行最终目标表的重新排列。
问候,tom lane
---------------------------(广播结束)------------------ ---------
提示9:如果您的
加入列的数据类型不匹配,规划人员将忽略您选择索引扫描的愿望
Nope. When you get into significant massaging of the input data,
usually the best bet is to COPY into a temp table that exactly matches
the format of the data file, and then do your rearrangements using an
INSERT/SELECT into the final target table.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match
嗨Joshua,
抱歉,我的意思是跳过一个专栏你不是那个文件,而不是数据库表,或者是什么?
谢谢
adam
Hi Joshua,
Sorry, I meant skip a column in the file, not the database table, or is that
what you meant?
Thanks
adam
Adam Witney写道:
Adam Witney wrote:
COPY命令是否可以从文件中读取数据,但跳过
具体栏目?
Hi,
Is it possible for the COPY command to read data from a file, but skip
specific columns?
<复制
COPY tablename [(column [,...])]
TO {''filename''| STDOUT}
[[WITH]
[BINARY]
[OIDS]
[DELIMITER [AS]''delimiter'']
[NULL [AS]'' null string'']
[CSV [QUOTE [AS]''quote'']
[ESCAPE [AS]''escape'']
[FORCE QUOTE专栏[,... ]]
是的......你只需要指定栏目......
真诚的,
Joshua D. Drake
< br>
\h copy
COPY tablename [ ( column [, ...] ) ]
TO { ''filename'' | STDOUT }
[ [ WITH ]
[ BINARY ]
[ OIDS ]
[ DELIMITER [ AS ] ''delimiter'' ]
[ NULL [ AS ] ''null string'' ]
[ CSV [ QUOTE [ AS ] ''quote'' ]
[ ESCAPE [ AS ] ''escape'' ]
[ FORCE QUOTE column [, ...] ]
Yes.. you just have to specify the columns...
Sincerely,
Joshua D. Drake
感谢
Adam
Thanks
Adam
-
此邮件已被MailScanner扫描病毒和
危险内容,并且
被认为是干净的。
- --------------------------(广播结束)------------------- --------
提示5:您是否检查过我们广泛的常见问题解答?
http://www.postgresql.org/docs/faq s / FAQ.html
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
这篇关于COPY可以跳过列吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!