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 22:11:31
Message-ID: CAEepm=3vbFL=Vrzz26jw=mN-XGA-iQ0+17YNtknNe9nY_ye3yw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Nov 2, 2018 at 3:00 PM Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> 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).

Pushed.

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2018-11-02 22:59:55 Re: Ris: BUG #15482: Foreign keys to a partition (NOT A PARTITIONED) break the server
Previous Message Alistair Johnson 2018-11-02 18:46:44 Unable to copy large (>2GB) files using PostgreSQL 11 (Windows)