Hi,
Shinoda, Noriyoshi wrote:
> I tried this feature with the latest snapshot. When I executed the
> following SQL statement, multiple primary keys were created on the
> partition. Is this the intended behavior?
Hahah. Is that a serious question? Of course it isn't. I'll fix it:
> -- test
> postgres=> CREATE TABLE part1(c1 INT PRIMARY KEY, c2 INT, c3 VARCHAR(10)) PARTITION BY RANGE(c1) ;
> CREATE TABLE
> postgres=> CREATE TABLE part1v1 (LIKE part1) ;
> CREATE TABLE
> postgres=> ALTER TABLE part1v1 ADD CONSTRAINT pk_part1v1 PRIMARY KEY (c1, c2) ;
> ALTER TABLE
> postgres=> ALTER TABLE part1 ATTACH PARTITION part1v1 FOR VALUES FROM (100) TO (200) ;
> ALTER TABLE
I think the correct behavior here is to error out the ATTACH PARTITION
indicating that a primary key already exist.
Thanks for pointing this out. Please keep testing,
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services