Re: How to implement the skip errors for copy from ?
От | Pavel Stehule |
---|---|
Тема | Re: How to implement the skip errors for copy from ? |
Дата | |
Msg-id | CAFj8pRBgTY+nW+tjmtTZb5an7n55nzV7rpkkkecGzQAeid1ahA@mail.gmail.com обсуждение исходный текст |
Ответ на | How to implement the skip errors for copy from ? (xbzhang <xbzhang@kingbase.com.cn>) |
Ответы |
Re: How to implement the skip errors for copy from ?
|
Список | pgsql-hackers |
2014-06-16 11:46 GMT+02:00 xbzhang <xbzhang@kingbase.com.cn>:
I want to implement the skip errors for copy from,lik as :create table A (c int primary key);copy A from stdin;112\.copy will failed:ERROR: duplicate key violates primary key constraint "CC_PKEY"
CONTEXT: COPY CC, line 2: "1"I want skip the error, and continue to copy the reset of tuple. The resultwill be that there are two rows in table A: 1 and 2.how to implement that ? Anybody give me some suggestion?
you should to reimplement a copy procedure to use a subtransactions. Using subtransaction for any row is too expensive, but you can do subtransaction per 1000 rows, and when some exception is raised, then store data per one row/one subtransaction.
Regards
Pavel Stehule
张晓博 研发二部
北京人大金仓信息技术股份有限公司
地址:北京市海淀区上地西路八号院上地科技大厦4号楼501
邮编:100085
电话:(010) 5885 1118 - 8450
手机:15311394463
В списке pgsql-hackers по дате отправления: