Re: Commit 4dba331cb3 broke ATTACH PARTITION behaviour.
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>
Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>,
alvherre@alvh.no-ip.org, Rushabh Lathia <rushabh.lathia@gmail.com>,
PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2018-04-02T05:29:26Z
Lists: pgsql-hackers
Attachments
- v3-fix_attach_partition.patch (text/plain) patch v3
Thanks Jeevan for reviewing.
On 2018/04/02 13:10, Jeevan Ladhe wrote:
> Hi,
>
> I noticed that there were no tests covering this case causing 4dba331cb3
>> to not notice this failure in the first place. I updated your patch to
>> add a few tests. Also, I revised the comment changed by your patch a bit.
>>
>
> 1. A minor typo:
>
> +-- check that violating rows are correctly reported when attching as the
> s/attching/attaching
Oops, fixed.
> 2. I think following part of the test is already covered:
>
> +-- trying to add a partition for 2 should fail because the default
> +-- partition contains a row that would violate its new constraint which
> +-- prevents rows containing 2
> +create table defpart_attach_test2 partition of defpart_attach_test for
> values in (2);
> +ERROR: updated partition constraint for default partition
> "defpart_attach_test_d" would be violated by some row
> +drop table defpart_attach_test;
>
> IIUC, the test in create_table covers the same scenario as of above:
>
> -- check default partition overlap
> INSERT INTO list_parted2 VALUES('X');
> CREATE TABLE fail_part PARTITION OF list_parted2 FOR VALUES IN ('W', 'X',
> 'Y');
> ERROR: updated partition constraint for default partition
> "list_parted2_def" would be violated by some row
Sorry, didn't realize that it was already covered in create_tabel.sql.
Removed this one.
Attached updated patch. Adding this to the v11 open items list.
Thanks,
Amit
Commits
-
Revert lowering of lock level for ATTACH PARTITION
- b8ca984b2c73 11.0 landed
-
Fix ALTER TABLE .. ATTACH PARTITION ... DEFAULT
- 72cf7f310c07 11.0 landed
-
Fix relcache handling of the 'default' partition
- 56163004b8b2 11.0 cited
-
Fix CommandCounterIncrement in partition-related DDL
- 4dba331cb3dc 11.0 cited
-
Fix lock upgrade hazard in ATExecAttachPartition.
- 972b6ec20bf0 10.0 cited