ERREUR: cache lookup failed for function 0 with PostgreSQL 15 beta 2, no error with PostgreSQL 14.4

Phil Florent <philflorent@hotmail.com>

From: Phil Florent <philflorent@hotmail.com>
To: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2022-08-04T13:19:59Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix failure to set correct operator in window run condition

  2. Teach planner and executor about monotonic window funcs

Hi,

A DSS developer from my company, Julien Roze, reported me an error I cannot explained. Is it a new behavior or a bug ?

Original query is much more complicated but here is a simplified test case with postgresql 14 and 15 beta 2 on Debian 11, packages from pgdg :

Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
15  main    5433 online postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log

psql -p 5432

select version();
                                                           version                                                           
-----------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 14.4 (Debian 14.4-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
(1 ligne)


with fakedata as (
               select 'hello' word
               union all
               select 'world' word
)
select *
from (
               select word, count(*) over (partition by word) nb from fakedata
) t where nb = 1;
 
  word  | nb 
-------+----
 hello |  1
 world |  1
(2 lignes)


with fakedata as (
               select 'hello' word
               union all
               select 'world' word
)
select *
from (
               select word, count(*) nb from fakedata group by word
) t where nb = 1;
 
  word  | nb 
-------+----
 hello |  1
 world |  1
(2 lignes)

psql -p 5433

 select version();
                                                              version                                                               
------------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 15beta2 (Debian 15~beta2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
(1 ligne)

with fakedata as (
               select 'hello' word
               union all
               select 'world' word
)
select *
from (
               select word, count(*) over (partition by word) nb from fakedata
) t where nb = 1;
ERREUR:  cache lookup failed for function 0

with fakedata as (
               select 'hello' word
               union all
               select 'world' word
)
select *
from (
               select word, count(*) nb from fakedata group by word
) t where nb = 1;
 
 word  | nb 
-------+----
 hello |  1
 world |  1
(2 lignes)


Best regards,
Phil