[BUGS] BUG #14485: Error in copy from temp

Поиск
Список
Период
Сортировка
От lars@ellebjerg.net
Тема [BUGS] BUG #14485: Error in copy from temp
Дата
Msg-id 20170104141554.10141.50575@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: [BUGS] BUG #14485: Error in copy from temp  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14485
Logged by:          Lars Ellebjerg
Email address:      lars@ellebjerg.net
PostgreSQL version: 9.6.0
Operating system:   Windows
Description:

I believe I have experienced an error in copying from a temporary table.

I have a csv-file with a column of ten-digit person registry numbers, some
of which start with zero.
I need to copy them to a column 'cpr' in a table, which also contains an id
serial column.
If I do this by copying them to a temp table with a single text column, and
then inserting them into the permanent table, the initial zero is removed
somewhere between the temp and the permanent table.
If I do the same using a permanent table instead of the temp table, the copy
works fine including the initial zeros.

create temporary table t (x1 text);

copy t (x1)
from 'C:/CPR hjemmesygepleje.csv' delimiter ';' csv;

insert into aeldrepleje.hjemmesygeplejemodtagere (cpr)
select x1 from t;

select * from aeldrepleje.hjemmesygeplejemodtagere;


create table aeldrepleje.hspm (cpr text);

copy aeldrepleje.hspm (cpr)
from 'C:/CPR hjemmesygepleje.csv' delimiter ';' csv;

insert into aeldrepleje.hjemmesygeplejemodtagere (cpr)
select cpr from aeldrepleje.hspm;

select * from aeldrepleje.hjemmesygeplejemodtagere;



--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: [BUGS] BUG #14243: pg_basebackup failes by a STATUS_DELETE_PENDINGfile
Следующее
От: web+postgresql@modin.io
Дата:
Сообщение: [BUGS] BUG #14486: Inserting and selecting interval have differentconstraints