From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Amit Langote <amitlangote09(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: Use of uninitialized variables in ExecFindPartition() for parent partition without leaves (HEAD only) |
Date: | 2017-11-30 01:11:09 |
Message-ID: | e0c4420d-5f7b-16fa-6b58-0a2e4a14d1e0@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Michael.
On 2017/11/30 9:07, Michael Paquier wrote:
> Hi all,
>
> Since commit 4e5fe9ad (committer Robert Haas and author Amit Langote),
> coverity has been complaining that the new code of ExecFindPartition()
> may use a set of values and isnull values which never get initialized.
> This is a state which can be easily reached with the following SQLs of
> a parent partition with no children:
> create table parent_tab (a int) partition by list ((a+0));
> insert into parent_tab values (1);
>
> The mistake is visibly that FormPartitionKeyDatum() should be called
> even for a root partition, initializing the fields of isnull and
> values on the way. That's actually what happens in execMain.c's
> ExecFindPartition() if you look at REL_10_STABLE. So the answer would
> be to move a bit down the quick exit code. Attached is a patch.
>
> Amit, that's your code. What do you think?
Thanks for the report. That's clearly a bug. :-(
Your patch seems enough to fix it. I added a test and expanded the
comment a bit in the attached updated version.
Thanks,
Amit
Attachment | Content-Type | Size |
---|---|---|
exec-partition-quickexit-v2.patch | text/plain | 2.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-11-30 01:15:56 | Re: [HACKERS] CONNECTION LIMIT and Parallel Query don't play well together |
Previous Message | Michael Paquier | 2017-11-30 01:01:54 | Re: [HACKERS] JIT compiling expressions/deform + inlining prototype v2.0 |