Re: BUG #15475: Views over CITEXT columns return no data

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: ps(at)ipggroup(dot)com, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15475: Views over CITEXT columns return no data
Date: 2018-11-02 02:00:49
Message-ID: CAEepm=3yR_T5sjoTnE9T0s-vph2OrEcSxf94kxfsZwKv_6wyJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Nov 2, 2018 at 2:29 PM Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> On Fri, Nov 2, 2018 at 2:07 PM Andrew Gierth
> <andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote:
> > >>>>> "Paul" == Paul Schaap <ps(at)ipggroup(dot)com> writes:
> > Paul> Hi Andrew,
> > Paul> Bingo, set enable_parallel_hash=false; gets a correct result
> > Paul> whereas set enable_parallel_hash=true; gets 0.
> >
> > Paul> Yes I might have reversed some of the explains, my excuse its
> > Paul> Friday and I went to bed late and am burnt out today :-)
> >
> > Are all the values of the my_citext column actually null?
>
> Thanks for the report Paul and the analysis Andrew. Discussed with
> Andrew a bit on IRC. Summary: multi-batch left joins are not handling
> NULLs correctly in the left table when partitioning. Looking into
> this now.

Here's a repro.

create table r as select generate_series(1, 1000000) i, null::int j;
update r set j = i where i <= 10;
create table s as select generate_series(1, 1000000) i;
analyze;
select count(*), count(r.j) from r left join s on r.j = s.i;

Unpatched master gives me a 16 batch Parallel Hash Join with the
incorrect answer:

count | count
-------+-------
10 | 10

With the attached patch the answer is correct:

count | count
---------+-------
1000000 | 10

The brown-paper-bag level fix is:

- false, /* outer join, currently unsupported */
+ HJ_FILL_OUTER(hjstate),

It is right and full outer joins that are not yet supported by
Parallel Hash Join. Left outer joins *are* supported. The effect of that
thinko is to make them behave like inner joins (but only in multi-batch
joins, ie when work_mem is exceeded).

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
0001-Fix-bug-in-multi-batch-Parallel-Hash-Left-Join.patch application/x-patch 1.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2018-11-02 02:30:53 Re: BUG #15437: Segfault during insert into declarative partitioned table with a trigger creating partition
Previous Message Amit Langote 2018-11-02 01:54:41 Re: BUG #15437: Segfault during insert into declarative partitioned table with a trigger creating partition