Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gI26R-00077S-TA for pgsql-bugs@arkaria.postgresql.org; Thu, 01 Nov 2018 01:48:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gI26Q-0003as-7V for pgsql-bugs@arkaria.postgresql.org; Thu, 01 Nov 2018 01:48:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gI26P-0003al-IO for pgsql-bugs@lists.postgresql.org; Thu, 01 Nov 2018 01:48:54 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gI26L-0007Rx-9z for pgsql-bugs@lists.postgresql.org; Thu, 01 Nov 2018 01:48:52 +0000 Received: by mail-pf1-x443.google.com with SMTP id u13-v6so2887462pfm.4 for ; Wed, 31 Oct 2018 18:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipggroup-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=ggQjoZtcCAqVKzyquPGClylIBI0+Mex0cta7qGOLGto=; b=AG8vKHs+FwLMJ1kQb+RKjkjH245mRP+JzU2OYgvaih17aSuniaPS5AIwnv9uW1sRCe 4A+j2JPkOW0NLrj6ASdB31mQUJvuskL/zH9z+kaKN44AoCjGSLOqDCwtuco54ByUm+WD n8vtZPdur+lRTbUFRWgssWVdHd95cTP/3r0VMRRCgqjlGrU1ILK7FQWEI9Rf+adF5+3I OalnCrPUJ3idDy1IbZbqagWARkIgUqWEnuaJuZP3YVm1Popm/ajoic+vf8+zHVj2AGG3 5DyC8kY0E1EL0Bdr1nvtIT+G+wuFjvnAazy9m8SxN/HVw1pxPjiZsRZdyoikQgm0nHP7 lPhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=ggQjoZtcCAqVKzyquPGClylIBI0+Mex0cta7qGOLGto=; b=A4tOIet99Y5fR0c2qw/cNTZd56yK1Ct5jNxZQKU8IJfcIgw7fPqDleonjpJOi0CKZy dGd1qu9nrHGhUnG8e2mWf8kHqBOT5QKFMIASfCkLDEP8aSTpQ4YPJ4JwBBmcf4ynUOFt +HVvJ878VgDxZXn/gpdahE8EGrERfR7P15IeCK+sBkllnbZ8fp8i+qUv5Hd+Y+b8r931 tZ4YOm5J/kSUnc+LL3jeV/I+LG2WVppCKwHTgSp4tpZ4dwzJvYb+Zy94kR+peI2N2s+u OcydYrZe/P3dQA2VLQJbEa7IP0+qSHj+kS464gzIJt/excN+hET6yjOwuDxiYuGZS2sD wFMA== X-Gm-Message-State: AGRZ1gJ2inIjGNfSGxILFEAsmPjf+spL+3HOrQkAHrFhjqEVxn39/uBU pgo/yrnYowrnWWzyLvwxAFCAKdrNbpkMZR8j2JpknHZsySoVyEMvs/04vzd+fGbIPQd0WWyB0C/ iaCpo9v34k5YkExFUEyIj X-Google-Smtp-Source: AJdET5d5quhnYZgApfgD1aPc9TvkrA5GIAQGLbyXedipI7u0cYjpIkbpXtg+qHf3W8chQCAuEhMpDA== X-Received: by 2002:aa7:8195:: with SMTP id g21-v6mr5748241pfi.71.1541036927577; Wed, 31 Oct 2018 18:48:47 -0700 (PDT) Received: from [192.168.6.53] ([61.69.255.122]) by smtp.gmail.com with ESMTPSA id s4-v6sm11485875pfh.168.2018.10.31.18.48.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 18:48:47 -0700 (PDT) From: Paul Schaap Message-Id: <19F765FE-34CC-4081-BFED-DFA2D38BF3BD@ipggroup.com> Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Subject: Re: BUG #15475: Views over CITEXT columns return no data Date: Thu, 1 Nov 2018 12:48:43 +1100 In-Reply-To: <40F193E8-0927-4B6A-96E0-7EC5603DC19A@ipggroup.com> Cc: pgsql-bugs@lists.postgresql.org To: Jeff Janes References: <15475-11a7a783fed72a36@postgresql.org> <40F193E8-0927-4B6A-96E0-7EC5603DC19A@ipggroup.com> X-Mailer: Apple Mail (2.3445.101.1) Content-Type: multipart/alternative; boundary="Apple-Mail=_4975D7BD-B436-4BBA-99B7-1E647D0C1774" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_4975D7BD-B436-4BBA-99B7-1E647D0C1774 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="ISO-8859-1" Hi Jeff, I have it now but it might be difficult for you to reproduce. 1) pg_dump a lookup table from a Postgres 10(.5) with -Fc and pg_restore to= Postgres 11 2) Join to the table in a view, but when you join do an INTEGER cast CREATE OR REPLACE VIEW citext_view AS SELECT citext_table.* FROM citext_table LEFT OUTER JOIN lookuptable ON citext_table.some_link:INT =3D lookuptable.= linkvalue; 3) Test with different quantities of data as it works with smaller quantiti= es of data, but fails with larger: -- Works with 1,000 INSERT INTO citext_table SELECT NULL, 'A', GENERATE_SERIES(1, 1000); SELECT type_id, COUNT(*) FROM citext_view WHERE type_id NOT IN ('2', '3') G= ROUP BY type_id; -- gets a 1000 value -- Doesn't work with 1,000,000 TRUNCATE TABLE citext_table; INSERT INTO citext_table SELECT NULL, 'A', GENERATE_SERIES(1, 1000000); SELECT type_id, COUNT(*) FROM citext_view WHERE type_id NOT IN ('2', '3') G= ROUP BY type_id; -- No rows come back n.b. I see nothing in the postgresql.log The workarounds I have discovered are: A) pg_dump in 11 and restore back in 11 B) pg_dump from 10 but NOT -Fc (so SQL) and restore to 11 C) Reverse the logic on the JOIN to citext_table.some_link =3D lookuptable.= linkvalue::CITEXT; CHEERS Paul > On 1 Nov 2018, at 10:06, Paul Schaap wrote: >=20 > Hi Jeff, >=20 > That was fast :-) >=20 > I am trying to create a script that reproduces the issue as it seems it i= s not quite that simple, please bear with me. >=20 > datcollate en_US.UTF-8 > datctype en_US.UTF-8 > SERVER_ENCODING UTF8 >=20 > CHEERS > Paul >=20 >> On 1 Nov 2018, at 10:00, Jeff Janes > wrote: >>=20 >> On Wed, Oct 31, 2018 at 6:45 PM PG Bug reporting form > wrote: >> The following bug has been logged on the website: >>=20 >> Bug reference: 15475 >> Logged by: Paul Schaap >> Email address: ps@ipggroup.com >> PostgreSQL version: 11.0 >> Operating system: OSX 10.14 and Ubuntu 18.10 >> Description: =20 >>=20 >> The steps to reproduce are: >> 1) Install CITEXT extension >> 2) Create a table with a CITEXT column >> 3) Create a view (not materialised) over the table >> 4) Query the view filtering on the CITEXT column >>=20 >> No data gets returned when querying via the view, this works under >> Postgresql 10 but not 11. >>=20 >>=20 >> There is no step here where you populate the table. >>=20 >> Add one, I can't reproduce this (on Ubuntu 16.04, so maybe that is impor= tant). >>=20 >> create extension citext ; >> create table j1 (x citext); >> insert into j1 values ('abc'); >> create view j2 as select * from j1; >> select * from j2 where x =3D'aBc'; >>=20 >> >>=20 >> What are your encoding, collation, and ctype? >>=20 >> Cheers, >>=20 >> Jeff >=20 --=20 PRIVACY & CONFIDENTIALITY NOTICE The information contained in this=20 email is intended for the named recipients =A0only.=A0 It may contain=20 privileged and confidential information and if you are =A0not the intended= =20 recipient, you should not copy it or disclose its contents =A0to any other= =20 person, or take any action in reliance on it.=A0 If you have =A0received th= is=20 email in error, please notify us immediately by return email. --Apple-Mail=_4975D7BD-B436-4BBA-99B7-1E647D0C1774 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="ISO-8859-1" Hi Jeff,

I have it now but it might be difficu= lt for you to reproduce.

1) pg_dump a lookup table from a Postgres 10(.5) with -Fc and pg_re= store to Postgres 11
2) Join to the table in a view, b= ut when you join do an INTEGER cast

CREATE OR REPL= ACE VIEW citext_view AS
SELECT citext_tab= le.*
FROM citext_table
 LEFT OUT= ER JOIN lookuptable ON citext_table.some_link:INT = =3D lookuptable.linkvalue;

=
3) Test with different quantities of d= ata as it works with smaller quantities of data, but fails with larger:

-- Works w= ith 1,000
INSERT INTO citext_table SELECT = ;NULL, 'A', GENERATE_SERIES(1, 1000);
SELECT&n= bsp;type_id, COUNT(*) FROM citext_view WHERE type_= id NOT IN ('2', '3') GROUP BY type_id;-- gets a 1000 value

-- Doesn't work with 1,000,000
TRUNCATE TABLE citext_table;
INSERT I= NTO citext_table SELECT NULL, 'A', GENERATE_SERIES= (1, 1000000);
SELECT type_id, COUNT(*) FR= OM citext_view WHERE type_id NOT IN ('2',&nbs= p;'3') GROUP BY type_id;
-- No r= ows come back

n.b= . I see nothing in the postgresql.log

The workarounds I have discovered are:
A) pg_dump in 11 and restore back in 11
B= ) pg_dump from 10 but NOT -Fc (so SQL) and restore to 11
C) Reverse the logic on the JOIN to citext_table.some_link&nbs= p;=3D lookuptable.linkvalue::CITEXT;

CHEERS
Paul

On= 1 Nov 2018, at 10:06, Paul Schaap <ps@ipggroup.com> wrote:

Hi Je= ff,

That was fast :-)

I am trying to cre= ate a script that reproduces the issue as it seems it is not quite that sim= ple, please bear with me.

datcollate en_US.UTF-8
datctype en_US.UT= F-8
SERVER_ENCODING UTF8
CHEERS
Paul

On 1 Nov 2018, at 10:00, Jeff Janes <jeff.janes@gmail.com> wrote:
On Wed, Oct 31, 20= 18 at 6:45 PM PG Bug reporting form <noreply@postgresql.org> wrote:
The foll= owing bug has been logged on the website:

Bug reference:      15475
Logged by:          Paul Schaap
Email address:      ps@ipggroup.com
PostgreSQL version: 11.0
Operating system:   OSX 10.14 and Ubuntu 18.10
Description:       

The steps to reproduce are:
1) Install CITEXT extension
2) Create a table with a CITEXT column
3) Create a view (not materialised) over the table
4) Query the view filtering on the CITEXT column

No data gets returned when querying via the view, this works under
Postgresql 10 but not 11.


There is no step here where you populate the table.

Add one, I can't reproduce this = (on Ubuntu 16.04, so maybe that is important).

create extension citext ;
create table j1 (x citext);
insert into j1 values ('abc');
c= reate view j2 as select * from j1;
select * from j2 where x =3D'aBc';

<see a row&g= t;

What are your encoding, collation, and ctype?

Cheers,

<= /div>
Jeff



PRIVACY & CONFIDENTIALITY NOTICE

<= font size=3D"2">The information contained in this email is intended for the= named recipients =A0only.=A0 It may contain privileged and confidential in= formation and if you are =A0not the intended recipient, you should not copy= it or disclose its contents =A0to any other person, or take any action in = reliance on it.=A0 If you have =A0received this email in error, please noti= fy us immediately by return email.

--Apple-Mail=_4975D7BD-B436-4BBA-99B7-1E647D0C1774--