pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Unexpected "cache lookup failed for collation 0" failure
5+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2019-11-13 d57d61533a 5a6eea0926  Add missing check_collation_set call to bpcharne().
* Unexpected "cache lookup failed for collation 0" failure
@ 2019-11-13 16:01  Manuel Rigger <rigger.manuel@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Manuel Rigger @ 2019-11-13 16:01 UTC (permalink / raw)
  To: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

Hi everyone,

Is the error "cache lookup failed for collation 0" in this context expected?

CREATE TABLE t0(c0 CHAR(2) COLLATE "C", c1 CHAR(2) COLLATE "POSIX");
INSERT INTO t0 VALUES('', '');
SELECT * FROM t0 WHERE t0.c1 NOT IN (t0.c0); -- unexpected: cache
lookup failed for collation 0

This looks like an internal error message to me. I would expect an
"ERROR:  could not determine which collation to use for string
comparison", which is shown in similar situations (e.g., when
replacing the "NOT IN" by "IN"). This appears like a minor issue to me
though.

Best,
Manuel





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Unexpected "cache lookup failed for collation 0" failure
@ 2019-11-13 16:50  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Manuel Rigger <rigger.manuel@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2019-11-13 16:50 UTC (permalink / raw)
  To: Manuel Rigger <rigger.manuel@gmail.com>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

Manuel Rigger <rigger.manuel@gmail.com> writes:
> Is the error "cache lookup failed for collation 0" in this context expected?

> CREATE TABLE t0(c0 CHAR(2) COLLATE "C", c1 CHAR(2) COLLATE "POSIX");
> INSERT INTO t0 VALUES('', '');
> SELECT * FROM t0 WHERE t0.c1 NOT IN (t0.c0); -- unexpected: cache
> lookup failed for collation 0

No, that's never expected (except maybe in concurrent-drop scenarios).

> This looks like an internal error message to me.

I get an assertion failure :-(, although the assertion is just
complaining about the same thing, ie no-collation-assigned.
Used to work before v12, too.  Looking...

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Unexpected "cache lookup failed for collation 0" failure
@ 2019-11-13 20:56  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2019-11-13 20:56 UTC (permalink / raw)
  To: Manuel Rigger <rigger.manuel@gmail.com>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

I wrote:
> Manuel Rigger <rigger.manuel@gmail.com> writes:
>> Is the error "cache lookup failed for collation 0" in this context expected?

>> CREATE TABLE t0(c0 CHAR(2) COLLATE "C", c1 CHAR(2) COLLATE "POSIX");
>> INSERT INTO t0 VALUES('', '');
>> SELECT * FROM t0 WHERE t0.c1 NOT IN (t0.c0); -- unexpected: cache
>> lookup failed for collation 0

> I get an assertion failure :-(, although the assertion is just
> complaining about the same thing, ie no-collation-assigned.
> Used to work before v12, too.  Looking...

Looks like a simple oversight --- when bpcharne() was made
collation-sensitive, it should have grown a check_collation_set()
call, but somehow that got left out.  Fixed.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Unexpected "cache lookup failed for collation 0" failure
@ 2019-11-14 04:03  Michael Paquier <michael@paquier.xyz>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Michael Paquier @ 2019-11-14 04:03 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Manuel Rigger <rigger.manuel@gmail.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

On Wed, Nov 13, 2019 at 03:56:11PM -0500, Tom Lane wrote:
> Looks like a simple oversight --- when bpcharne() was made
> collation-sensitive, it should have grown a check_collation_set()
> call, but somehow that got left out.  Fixed.

Wouldn't it be better to add a test case for that?
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Unexpected "cache lookup failed for collation 0" failure
@ 2019-11-14 04:09  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2019-11-14 04:09 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Manuel Rigger <rigger.manuel@gmail.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

Michael Paquier <michael@paquier.xyz> writes:
> On Wed, Nov 13, 2019 at 03:56:11PM -0500, Tom Lane wrote:
>> Looks like a simple oversight --- when bpcharne() was made
>> collation-sensitive, it should have grown a check_collation_set()
>> call, but somehow that got left out.  Fixed.

> Wouldn't it be better to add a test case for that?

Didn't see the point particularly; we're not any more likely to
break this function than any other collation-dependent function.

The real question IMO is whether Peter missed any *other* places.
I dug through varlena.c and varchar.c and confirmed that every
call of PG_GET_COLLATION leads to a collation-is-not-zero test
(after this fix), but I didn't try to search the whole backend.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2019-11-14 04:09 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 16:01 Unexpected "cache lookup failed for collation 0" failure Manuel Rigger <rigger.manuel@gmail.com>
2019-11-13 16:50 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-11-13 20:56   ` Tom Lane <tgl@sss.pgh.pa.us>
2019-11-14 04:03     ` Michael Paquier <michael@paquier.xyz>
2019-11-14 04:09       ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox