From: 德哥 <digoal@126.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14341: insert on conflict (key_column) cann't used with partition table.
Date: Wed, 28 Sep 2016 17:16:09 +0800 (CST)
Message-ID: <58f17eb8.b93b.15770146d7d.Coremail.digoal@126.com> (raw)
In-Reply-To: <27411.1474981474@sss.pgh.pa.us>
References: <20160927121914.27030.28215@wrigleys.postgresql.org>
<27411.1474981474@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
$ git clone https://github.com/postgrespro/pg_pathman
$ cd pg_pathman
$ export PATH=/home/digoal/pgsql9.6rc1/bin:$PATH
$ make USE_PGXS=1
$ make install USE_PGXS=1
$ vi $PGDATA/postgresql.conf
shared_preload_libraries='pg_pathman'
$ pg_ctl restart -m fast
$ psql
postgres=# create extension pg_pathman;
CREATE EXTENSION
$ psql
postgres=# drop table test;
postgres=# create table test(id int primary key, info text, crt_time timestamptz);
CREATE TABLE
postgres=#
postgres=# select create_range_partitions('test'::regclass, 'id', 1, 20000000, 100, false);
create_range_partitions
-------------------------
100
(1 row)
postgres=# select disable_parent('test'::regclass);
disable_parent
----------------
(1 row)
reconnect
postgres=# explain select * from test where id=1;
QUERY PLAN
---------------------------------------------------------------------------------
Append (cost=0.15..2.17 rows=1 width=44)
-> Index Scan using test_1_pkey on test_1 (cost=0.15..2.17 rows=1 width=44)
Index Cond: (id = 1)
(3 rows)
insert into test(id,info,crt_time) values(:id, md5(random()::text), now()) on conflict (id) do update set info=excluded.info,crt_time=excluded.crt_time;
--
公益是一辈子的事,I'm Digoal,Just Do It.
At 2016-09-27 21:04:34, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
>digoal@126.com writes:
>> postgres=# \d test
>> Table "postgres.test"
>> Column | Type | Modifiers
>> ----------+-----------------------------+-----------
>> id | integer | not null
>> info | text |
>> crt_time | timestamp without time zone |
>> Indexes:
>> "test_pkey" PRIMARY KEY, btree (id)
>> Number of child tables: 100 (Use \d+ to list them.)
>
>> postgres=# insert into test(id,info,crt_time) values(1, md5(random()::text),
>> now()) on conflict (id) do update set
>> info=excluded.info,crt_time=excluded.crt_time;
>> ERROR: XX000: unexpected failure to find arbiter index
>> LOCATION: ExecCheckIndexConstraints, execIndexing.c:594
>
>Can't reproduce that on the basis of the given information.
>
> regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: digoal@126.com, tgl@sss.pgh.pa.us
Subject: Re: BUG #14341: insert on conflict (key_column) cann't used with partition table.
In-Reply-To: <58f17eb8.b93b.15770146d7d.Coremail.digoal@126.com>
References: <20160927121914.27030.28215@wrigleys.postgresql.org> <27411.1474981474@sss.pgh.pa.us> <58f17eb8.b93b.15770146d7d.Coremail.digoal@126.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox