On 2016/12/27 18:30, Rajkumar Raghuwanshi wrote: > Hi Amit, > > I have pulled latest sources from git and tried to create multi-level > partition, getting a server crash, below are steps to reproduce. please > check if it is reproducible in your machine also. >
[ ... ] > postgres=# INSERT INTO test_ml SELECT i, i, to_char(i, 'FM0000') FROM > generate_series(0, 599, 2) i; > server closed the connection unexpectedly > This probably means the server terminated abnormally > before or while processing the request. > The connection to the server was lost. Attempting reset: Failed. Thanks for the example. Looks like there was an oversight in my patch that got committed as 2ac3ef7a01 [1]. Attached patch should fix the same. Thanks, Amit [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=2ac3ef7a01df859c62d0a02333b646d65eaec5ff
diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c index fca874752f..f9daf8052d 100644 --- a/src/backend/catalog/partition.c +++ b/src/backend/catalog/partition.c @@ -1647,6 +1647,7 @@ get_partition_for_tuple(PartitionDispatch *pd, PartitionDesc partdesc = parent->partdesc; TupleTableSlot *myslot = parent->tupslot; TupleConversionMap *map = parent->tupmap; + ExprContext *econtext = GetPerTupleExprContext(estate); /* Quick exit */ if (partdesc->nparts == 0) @@ -1667,6 +1668,7 @@ get_partition_for_tuple(PartitionDispatch *pd, } /* Extract partition key from tuple */ + econtext->ecxt_scantuple = slot; FormPartitionKeyDatum(parent, slot, estate, values, isnull); if (key->strategy == PARTITION_STRATEGY_RANGE) diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index bca34a509c..1d699c1dab 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -3107,9 +3107,7 @@ ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd, { int result; Oid failed_at; - ExprContext *econtext = GetPerTupleExprContext(estate); - econtext->ecxt_scantuple = slot; result = get_partition_for_tuple(pd, slot, estate, &failed_at); if (result < 0) {
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers