Menu

#379 Named prepared statement remain in pooler

V1.0 maintenance
open
nobody
5
2013-01-23
2013-01-23
No

See the following result. Named prepared statement remains in the pooler even after connection from application to a coordinator is disconnected.

--------8<-------- prepare-error2.sql -----------8<----------
-------------------
-- 0. drop table
-------------------
drop table if exists t1;

-------------------
-- 1. create table
-------------------
create table t1 (
c1 varchar(10)
,c2 varchar(10)
,c3 varchar(20)
,c4 varchar(4)
,constraint t1_pk primary key
(c1,c2,c3)
)
distribute by hash(C2);

-------------------
-- 2. insert
-------------------
insert into t1 values ('A1','111','111','0090');

-------------------
-- 3. prepare
-------------------
prepare foo (varchar, varchar, varchar, varchar) as
update t1 set c4 =
(select case when c4='0001' then '9999' else ltrim(to_char((cast(c4 as integer)-1),'0000')) end as c4 from t1 where c2 = $1 and c3 = $2)
where c2 = $3 and c3 = $4;

-------------------
-- 3. execute
-------------------
execute foo ('111','111','111','111');

------->8----------------->8-----------

The result

1) 1st turn;

$ psql -p 50004 -h node06 db1 < prepare-error2.sql
DROP TABLE
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pk" for table "t1"
CREATE TABLE
INSERT 0 1
PREPARE
ERROR: bind message supplies 4 parameters, but prepared statement "" requires 2

This was reported as bug 3601848

2) 2nd turn

$ psql -p 50004 -h node06 db1 < prepare-error2.sql
DROP TABLE
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pk" for table "t1"
CREATE TABLE
INSERT 0 1
PREPARE
ERROR: prepared statement "foo" already exists

Named prepared statement remains in the pooler.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.