From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
---|---|
To: | phuongnh2 <phuongnh2(at)vng(dot)com(dot)vn> |
Cc: | "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: Issue import (COPY) data by between miss lines |
Date: | 2015-05-11 21:11:15 |
Message-ID: | CAECtzeXwoxcahDDRvEok3P=2F5phQJ4fXxxCwt=+gTwn6R4QyQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi,
2015-05-08 6:41 GMT+02:00 phuongnh2 <phuongnh2(at)vng(dot)com(dot)vn>:
> Hi Admin,
> How to config postgres to result below ??
>
> CREATE TEMP TABLE foo (a bigint, b text);
> -- input_file.txt --
>
> 1 one
> 2
> 3 three 111
> four 4
> 5 five
> error logging off
> COPY foo FROM 'input_file.txt';
>
> ERROR: missing data for column "b"
> CONTEXT: COPY foo, line 2: "2"
>
> skip bad rows
> --skip bad rows
> COPY foo FROM 'input_file.txt' (ERROR_LOGGING,
> ERROR_LOGGING_SKIP_BAD_ROWS);
> SELECT * FROM foo;
>
> a | b
> ---+------
> 1 | one
> 5 | five
> (2 rows)
>
>
You can't use COPY do to that. That feature does not exist with PostgreSQL
itself. pgloader should be able to do that, you should take a look.
--
Guillaume.
http://blog.guillaume.lelarge.info
http://www.dalibo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Aherne | 2015-05-12 01:02:11 | SSL and MD5 passwords |
Previous Message | Andre_Mikulec | 2015-05-11 14:38:50 | Re: How do I install/run PostgreSQL 9.4 64 bit on Windows 7 Professional? |