PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16467
PG Version9.6.17
OSRed Hat 4.8.5-39
Opened2020-05-27 22:09:09+00
Reported byAndrey Marinchuk
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16467
Logged by:          Andrey Marinchuk
Email address:      (redacted)
PostgreSQL version: 9.6.17
Operating system:   Red Hat 4.8.5-39
Description:        

Reproduced in:
"PostgreSQL 9.6.17 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-39), 64-bit"
"PostgreSQL 10.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-28), 64-bit"
Not reproduced in 12.2.

Steps to reproduce:
1. open two connections (#1 and #2)
2. in connection #1 run script 0
3. in connection #1 run script 1
4. in connection #2 start transaction and run query: select
textXX000.testXX000(public.textXX000_internal('iteration #'), 1);
5. in connection #1 run script 1 again
6. in connection #2 start savepoint and run query: select
textXX000.testXX000(public.textXX000_internal('iteration #'), 2);
7. in connection #2 rollback to savepoint and run query: select
textXX000.testXX000(public.textXX000_internal('iteration #'), 3);

Expected: query in 6 executed without error
Actual (9.6.17):
crm_com=# begin;
BEGIN
crm_com=# \set VERBOSITY verbose
crm_com=# select textXX000.testXX000(public.textXX000_internal('iteration
#'), 1);
  testxx000
--------------
 iteration #1
(1 line)


crm_com=# savepoint sp;
SAVEPOINT
crm_com=# select textXX000.testXX000(public.textXX000_internal('iteration
#'), 2);
ERROR:  XX000: cache lookup failed for function 182081751
Location:  simplify_function, clauses.c:3894
crm_com=# rollback to sp;
ROLLBACK
crm_com=# select textXX000.testXX000(public.textXX000_internal('iteration
#'), 3);
  testxx000
--------------
 iteration #3
(1 line)

script 0:
create or replace function public.textXX000_internal(t in text, flag in
boolean default true) returns text as $$
select case when flag then t else (select nspname::text from
pg_catalog.pg_namespace where nspname = 'public') end
$$ language sql stable called on null input;
script 1:
BEGIN;
DROP SCHEMA IF EXISTS textXX000 CASCADE;
CREATE SCHEMA textXX000;
GRANT USAGE ON SCHEMA textXX000 TO public;
ALTER DEFAULT PRIVILEGES IN SCHEMA textXX000 GRANT EXECUTE ON FUNCTIONS TO
public;
SET SEARCH_PATH TO testXX000;
create or replace function textXX000.testXX000(t in text, i integer) returns
text as $$
begin
  return t || i;
end;
$$ language plpgsql stable returns null on null input;
END;


Additional info: also tested with PostgreSQL 9.6.3 via JDBC, see
https://github.com/pgjdbc/pgjdbc/issues/1786

Messages

DateAuthorSubject
2020-05-27 22:09:09+00PG Bug reporting formBUG #16467: XX000 fun
2020-05-28 05:37:19+00Kyotaro HoriguchiRe: BUG #16467: XX000 fun