On 2016/12/27 18:48, 高增琦 wrote:
> Hi ,
>
> I tried "COPY FROM" in the git version. It inserts rows to wrong partition.
>
> step to reproduce:
> create table t(a int, b int) partition by range(a);
> create table t_p1 partition of t for values from (1) to (100);
> create table t_p2 partition of t for values from (100) to (200);
> create table t_p3 partition of t for values from (200) to (300);
> insert into t values(1,1);
> insert into t values(101,101);
> insert into t values(201,201);
> copy (select * from t) to '/tmp/test2.txt';
> copy t from '/tmp/test2.txt';
> select * from t_p1;
>
> result:
> postgres=# select * from t_p1;
> a | b
> -----+-----
> 1 | 1
> 1 | 1
> 101 | 101
> 201 | 201
> (4 rows)
>
> I think the argument "BulkInsertState" used in CopyFrom/heap_insert
> is related to this problem. Please check it.
You're quite right. Attached should fix that.
Thanks,
Amit
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers