Skip site navigation (1) Skip section navigation (2)

Bug in get_partition_for_tuple

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug in get_partition_for_tuple
Date: 2017-03-10 02:56:45
Message-ID: d64f8498-70eb-3c88-b56d-c54fd3b0500f@lab.ntt.co.jp (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-hackers
Just observed a crash due to thinko in the logic that handles NULL
partition key.  Absence of null-accepting partition in this case should
have caused an error, instead the current code proceeds with comparison
resulting in crash.

create table p (a int, b char) partition by list (b);
create table p1 partition of p for values in ('a');
insert into p values (1);   -- crashes

Attached patch fixes that and adds a test.

Thanks,
Amit

Attachment: 0001-Fix-a-bug-in-get_partition_for_tuple.patch
Description: text/x-diff (3.1 KB)

Responses

pgsql-hackers by date

Next:From: Peter GeogheganDate: 2017-03-10 03:04:46
Subject: Re: amcheck (B-Tree integrity checking tool)
Previous:From: Peter GeogheganDate: 2017-03-10 02:54:19
Subject: Re: on_dsm_detach() callback and parallel tuplesort BufFile resource management

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group