BUG #16467: XX000 fun

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: radist(dot)nt(at)gmail(dot)com
Subject: BUG #16467: XX000 fun
Date: 2020-05-27 22:09:09
Message-ID: 16467-12cd2b5cdb4f90c5@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16467
Logged by: Andrey Marinchuk
Email address: radist(dot)nt(at)gmail(dot)com
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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-05-28 00:21:26 Re: Explicit deterministic COLLATE fails with pattern matching operations on column with non-deterministic collation
Previous Message Alexander Lakhin 2020-05-27 21:00:00 Re: BUG #16466: Valgrind detects an invalid read in dblink_open() with a cursor inside a transaction