Re: Declarative partitioning - another take

Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com>

From: Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, Robert Haas <robertmhaas@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2016-09-06T11:15:29Z
Lists: pgsql-hackers
Hi,

I have applied updated patches given by you, and observe below.

here in the given example, t6_p3 partition is not allowed to have null, but
I am able to insert it, causing two nulls in the table.

--create a partition table
create table t6 (a int, b varchar) partition by list(a);
create table t6_p1 partition of t6 for values in (1,2,null);
create table t6_p2 partition of t6 for values in (4,5);
create table t6_p3 partition of t6 for values in (3,6);

--insert some values
insert into t6 select i,i::varchar from generate_series(1,6) i;
insert into t6 values (null,'A');

--try inserting null to t6_p3 partition table
insert into t6_p3 values (null,'A');

select tableoid::regclass,* from t6;
 tableoid | a | b
----------+---+---
 t6_p1    | 1 | 1
 t6_p1    | 2 | 2
 t6_p1    |   | A
 t6_p2    | 4 | 4
 t6_p2    | 5 | 5
 t6_p3    | 3 | 3
 t6_p3    | 6 | 6
 t6_p3    |   | A
(8 rows)

Thanks & Regards,
Rajkumar Raghuwanshi
QMG, EnterpriseDB Corporation

On Tue, Sep 6, 2016 at 1:37 PM, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
wrote:

>
> Hi,
>
> On 2016/09/06 16:13, Ashutosh Bapat wrote:
> > I found a server crash while running make check in regress folder. with
> > this set of patches. Problem is RelationBuildPartitionKey() partexprsrc
> may
> > be used uninitialized. Initializing it with NIL fixes the crash. Here's
> > patch to fix it. Came up with the fix after discussion with Amit.
>
> Thanks for the report.  Here is a rebased version of the patches including
> you fix (no significant changes from those posted on Aug 26).
>
> 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
>
>

Commits

  1. Fix typo.

  2. Document trigger-firing behavior for inheritance/partitioning.

  3. Fire per-statement triggers on partitioned tables.

  4. Set ecxt_scantuple correctly for tuple routing.

  5. Fix interaction of partitioned tables with BulkInsertState.

  6. Avoid core dump for empty prepared statement in an aborted transaction.

  7. Fix some problems in check_new_partition_bound().

  8. Remove unnecessary arguments from partitioning functions.

  9. Fix reporting of constraint violations for table partitioning.

  10. Fix tuple routing in cases where tuple descriptors don't match.

  11. Invalid parent's relcache after CREATE TABLE .. PARTITION OF.

  12. Doc: improve documentation about inheritance.