BUG #18059: Unexpected error 25001 in stored procedure

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: paul(dot)kulakov(at)systematica(dot)ru
Subject: BUG #18059: Unexpected error 25001 in stored procedure
Date: 2023-08-17 14:35:23
Message-ID: 18059-79c692f036b25346@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following bug has been logged on the website:

Bug reference: 18059
Logged by: Pavel Kulakov
Email address: paul(dot)kulakov(at)systematica(dot)ru
PostgreSQL version: 15.4
Operating system: Debian GNU/Linux 11
Description:

Steps to reproduce:
1. Create stored procedure

create or replace procedure test_proc()
language plpgsql as $procedure$
begin
commit;
set transaction isolation level repeatable read;
-- here follows some useful code which is omitted for brevity
end
$procedure$;

2. Open new connection

3. Execute the following 3 queries one by one:
a) call test_proc();
b) create temporary table "#tmp"(c int) on commit drop;
c) call test_proc();
On step c) you'll get an error
[25001]: ERROR: SET TRANSACTION ISOLATION LEVEL must be called before any
query
Where: SQL statement "set transaction isolation level repeatable read"
PL/pgSQL function test_proc() line 4 at SQL statement
--------------------------------------------
I used 3 different instruments with the same problem everywhere:
1) libpq in my own C++ application
2) DBeaver
3) npgsql in my own C# application

The same problem occures on PostgreSQL 14.4 running on Windows 10.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Emile Amewoto (ZA) 2023-08-17 20:27:35 Postgresql15 crash with :FATAL: could not open shared memory segment "/PostgreSQL.0000000": No such file or directory
Previous Message Andrew Dunstan 2023-08-17 14:27:36 Re: BUG #17994: Invalidating relcache corrupts tupDesc inside ExecEvalFieldStoreDeForm()

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-08-17 14:40:41 Re: run pgindent on a regular basis / scripted manner
Previous Message Robert Haas 2023-08-17 14:30:17 Re: Extending SMgrRelation lifetimes