Here a first PQtrace() file... assuming it can help.
Seb
________________________________
From: Sebastien Flaesch <sebastien.flae...@4js.com>
Sent: Monday, April 8, 2024 5:31 PM
To: pgsql-general <pgsql-general@lists.postgresql.org>
Cc: Sebastien Flaesch <sebastien.flae...@4js.com>
Subject: prepared statement "cu1" already exists (but it does not)

Hello,

In a specific case, I get the error

  prepared statement "cu1" already exists

I understand when this can happen, but in fact I do de-allocate prepared 
statements when I should.

I am investigating on this for several hours now, I thought I could share my 
problem to see if this ring a bell.

I am using PostgreSQL 16.2 or 15.1 (I can try older versions if needed)

Platform is Debian 11

I am using the libpq C API to execute SQL statements, mixing:


  *
PQprepare
  *
PQexecPrepared
  *
PQexecParams
  *
PQexec

When a prepared statement handle is no longer needed, I do execute

       deallocate cu1

(seems there is no C API to de-allocate a prepared statement, right?)

For result sets (SELECT), I do PQprepare / PQexecPrepared of "server cursors" 
with:

      declare cu1 cursor for ...

When a server cursor is no longer needed, I do PQexec(conn, "close curs-name')

The problem occurs when doing a first transaction, where an INSERT fails 
because of a table UNIQUE constraint.

After the rollback, I restart a new TX with begin, several PQexec() of SELECT 
and UPDATE succeed, but on a subsequent PQprepare/PQexecPrepared using a 
"declare cu1 cursor for select ...", I the error "cu1 statement already 
exists"... and I don't see how cu1 can exist.

Before doing the rollback, I try to deallocate the prepared statement with 
deallocate cu1, but this fails with error:

   current transaction is aborted, commands ignored until end of transaction 
block

I understand that the whole TX is aborted with PostgreSQL, and probably the 
deallocate is useless since stmt was prepared inside the TX?

I just want to make sure that doing a deallocate in this context does not 
confuse PostgreSQL.

I have tried to skip the deallocate in case of SQL error, but on the subsequent 
PQprepare/PQexecPrepared, I still get the error that the cu1 statement already 
exists.

Is it an issue if I use the same name for a prepared statement and the server 
cursor? I mean:

   PQprepare(pgConn, "cu1", "declare cu1 cursor for ... ", ... )
   PQexecPrepared(pgConn, "cu1", ... )

My understanding is that a prepared stmt and server cursor are 2 distinct 
objects.

Anyway: I tried to use distinct names but that did not help.

Note that when the INSERT succeeds, I do not get the error prepared statement 
"cu1" already exists


Any suggestion is welcome!

Seb

2024-04-08 18:23:11.280594      F       33      Query    "set 
intervalstyle='iso_8601'"
2024-04-08 18:23:11.280740      B       8       CommandComplete  "SET"
2024-04-08 18:23:11.280743      B       27      ParameterStatus  
"IntervalStyle" "iso_8601"
2024-04-08 18:23:11.280745      B       5       ReadyForQuery    I
2024-04-08 18:23:11.280781      F       67      Query    "update pg_settings 
set setting=10000 where name='lock_timeout'"
2024-04-08 18:23:11.281610      B       35      RowDescription   1 "set_config" 
0 0 25 65535 -1 0
2024-04-08 18:23:11.281620      B       13      DataRow  1 3 '10s'
2024-04-08 18:23:11.281622      B       13      CommandComplete  "UPDATE 0"
2024-04-08 18:23:11.281623      B       5       ReadyForQuery    I
2024-04-08 18:23:11.281698      F       10      Query    "begin"
2024-04-08 18:23:11.281720      B       10      CommandComplete  "BEGIN"
2024-04-08 18:23:11.281722      B       5       ReadyForQuery    T
2024-04-08 18:23:11.281854      F       250     Parse    "cu0" "declare srv_cu0 
cursor for select udsi_table_name, udsi_last_mtime, udsi_temp_mtime, 
udsi_can_insert, udsi_can_update, udsi_can_delete, udsi_where_part, 
udsi_position from   dbsync_udsinfo where udsi_user_id = $1 order by 
udsi_position" 1 1043
2024-04-08 18:23:11.281855      F       4       Sync
2024-04-08 18:23:11.282200      B       4       ParseComplete
2024-04-08 18:23:11.282206      B       5       ReadyForQuery    T
2024-04-08 18:23:11.282210      F       27      Bind     "" "cu0" 1 0 1 4 
'mike' 1 0
2024-04-08 18:23:11.282211      F       6       Describe         P ""
2024-04-08 18:23:11.282213      F       9       Execute  "" 0
2024-04-08 18:23:11.282214      F       4       Sync
2024-04-08 18:23:11.282512      B       4       BindComplete
2024-04-08 18:23:11.282517      B       4       NoData
2024-04-08 18:23:11.282519      B       19      CommandComplete  "DECLARE 
CURSOR"
2024-04-08 18:23:11.282520      B       5       ReadyForQuery    T
2024-04-08 18:23:11.282523      F       34      Query    "fetch absolute 0 from 
srv_cu0"
2024-04-08 18:23:11.282600      B       276     RowDescription   8 
"udsi_table_name" 25071 2 1043 65535 54 0 "udsi_last_mtime" 25071 8 1114 8 3 0 
"udsi_temp_mtime" 25071 9 1114 8 3 0 "udsi_can_insert" 25071 4 1042 65535 5 0 
"udsi_can_update" 25071 5 1042 65535 5 0 "udsi_can_delete" 25071 6 1042 65535 5 
0 "udsi_where_part" 25071 7 1043 65535 2004 0 "udsi_position" 25071 3 23 4 -1 0
2024-04-08 18:23:11.282604      B       12      CommandComplete  "FETCH 0"
2024-04-08 18:23:11.282605      B       5       ReadyForQuery    T
2024-04-08 18:23:11.282649      F       34      Query    "fetch forward 50 from 
srv_cu0"
2024-04-08 18:23:11.282741      B       276     RowDescription   8 
"udsi_table_name" 25071 2 1043 65535 54 0 "udsi_last_mtime" 25071 8 1114 8 3 0 
"udsi_temp_mtime" 25071 9 1114 8 3 0 "udsi_can_insert" 25071 4 1042 65535 5 0 
"udsi_can_update" 25071 5 1042 65535 5 0 "udsi_can_delete" 25071 6 1042 65535 5 
0 "udsi_where_part" 25071 7 1043 65535 2004 0 "udsi_position" 25071 3 23 4 -1 0
2024-04-08 18:23:11.282745      B       71      DataRow  8 6 'author' 23 
'2024-04-08 12:59:40.765' -1 1 'Y' 1 'Y' 1 'Y' -1 1 '1'
2024-04-08 18:23:11.282747      B       69      DataRow  8 4 'book' 23 
'2024-04-08 12:59:40.765' -1 1 'Y' 1 'Y' 1 'Y' -1 1 '2'
2024-04-08 18:23:11.282748      B       12      CommandComplete  "FETCH 2"
2024-04-08 18:23:11.282749      B       5       ReadyForQuery    T
2024-04-08 18:23:11.282850      F       34      Query    "fetch forward 50 from 
srv_cu0"
2024-04-08 18:23:11.282919      B       276     RowDescription   8 
"udsi_table_name" 25071 2 1043 65535 54 0 "udsi_last_mtime" 25071 8 1114 8 3 0 
"udsi_temp_mtime" 25071 9 1114 8 3 0 "udsi_can_insert" 25071 4 1042 65535 5 0 
"udsi_can_update" 25071 5 1042 65535 5 0 "udsi_can_delete" 25071 6 1042 65535 5 
0 "udsi_where_part" 25071 7 1043 65535 2004 0 "udsi_position" 25071 3 23 4 -1 0
2024-04-08 18:23:11.282922      B       12      CommandComplete  "FETCH 0"
2024-04-08 18:23:11.282923      B       5       ReadyForQuery    T
2024-04-08 18:23:11.282974      F       18      Query    "close srv_cu0"
2024-04-08 18:23:11.283040      B       17      CommandComplete  "CLOSE CURSOR"
2024-04-08 18:23:11.283042      B       5       ReadyForQuery    T
2024-04-08 18:23:11.283109      F       104     Parse    "" "update 
dbsync_udsinfo SET udsi_user_id = udsi_user_id WHERE udsi_table_name IN 
('author','book')" 0
2024-04-08 18:23:11.283110      F       14      Bind     "" "" 0 0 1 0
2024-04-08 18:23:11.283111      F       6       Describe         P ""
2024-04-08 18:23:11.283112      F       9       Execute  "" 0
2024-04-08 18:23:11.283113      F       4       Sync
2024-04-08 18:23:11.283325      B       4       ParseComplete
2024-04-08 18:23:11.283326      B       4       BindComplete
2024-04-08 18:23:11.283327      B       4       NoData
2024-04-08 18:23:11.283328      B       13      CommandComplete  "UPDATE 4"
2024-04-08 18:23:11.283329      B       5       ReadyForQuery    T
2024-04-08 18:23:11.283383      F       137     Parse    "" "select 
udsi_last_mtime from   dbsync_udsinfo where udsi_user_id = $1 AND 
udsi_table_name = $2 AND udsi_temp_mtime IS NULL" 2 1043 1043
2024-04-08 18:23:11.283385      F       36      Bind     "" "" 2 0 0 2 4 'mike' 
6 'author' 1 0
2024-04-08 18:23:11.283386      F       6       Describe         P ""
2024-04-08 18:23:11.283387      F       9       Execute  "" 0
2024-04-08 18:23:11.283388      F       4       Sync
2024-04-08 18:23:11.283454      B       4       ParseComplete
2024-04-08 18:23:11.283456      B       4       BindComplete
2024-04-08 18:23:11.283457      B       40      RowDescription   1 
"udsi_last_mtime" 25071 8 1114 8 3 0
2024-04-08 18:23:11.283459      B       33      DataRow  1 23 '2024-04-08 
12:59:40.765'
2024-04-08 18:23:11.283460      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.283461      B       5       ReadyForQuery    T
2024-04-08 18:23:11.283520      F       106     Parse    "" "select 
udsi_user_id from   dbsync_udsinfo where udsi_user_id = $1 AND udsi_table_name 
= $2" 2 1043 1043
2024-04-08 18:23:11.283521      F       36      Bind     "" "" 2 0 0 2 4 'mike' 
6 'author' 1 0
2024-04-08 18:23:11.283523      F       6       Describe         P ""
2024-04-08 18:23:11.283524      F       9       Execute  "" 0
2024-04-08 18:23:11.283525      F       4       Sync
2024-04-08 18:23:11.283573      B       4       ParseComplete
2024-04-08 18:23:11.283575      B       4       BindComplete
2024-04-08 18:23:11.283576      B       37      RowDescription   1 
"udsi_user_id" 25071 1 1043 65535 24 0
2024-04-08 18:23:11.283577      B       14      DataRow  1 4 'mike'
2024-04-08 18:23:11.283578      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.283579      B       5       ReadyForQuery    T
2024-04-08 18:23:11.283640      F       137     Parse    "" "select 
udsi_last_mtime from   dbsync_udsinfo where udsi_user_id = $1 AND 
udsi_table_name = $2 AND udsi_temp_mtime IS NULL" 2 1043 1043
2024-04-08 18:23:11.283642      F       34      Bind     "" "" 2 0 0 2 4 'mike' 
4 'book' 1 0
2024-04-08 18:23:11.283643      F       6       Describe         P ""
2024-04-08 18:23:11.283644      F       9       Execute  "" 0
2024-04-08 18:23:11.283645      F       4       Sync
2024-04-08 18:23:11.283691      B       4       ParseComplete
2024-04-08 18:23:11.283692      B       4       BindComplete
2024-04-08 18:23:11.283694      B       40      RowDescription   1 
"udsi_last_mtime" 25071 8 1114 8 3 0
2024-04-08 18:23:11.283695      B       33      DataRow  1 23 '2024-04-08 
12:59:40.765'
2024-04-08 18:23:11.283696      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.283697      B       5       ReadyForQuery    T
2024-04-08 18:23:11.283751      F       106     Parse    "" "select 
udsi_user_id from   dbsync_udsinfo where udsi_user_id = $1 AND udsi_table_name 
= $2" 2 1043 1043
2024-04-08 18:23:11.283753      F       34      Bind     "" "" 2 0 0 2 4 'mike' 
4 'book' 1 0
2024-04-08 18:23:11.283754      F       6       Describe         P ""
2024-04-08 18:23:11.283755      F       9       Execute  "" 0
2024-04-08 18:23:11.283756      F       4       Sync
2024-04-08 18:23:11.283799      B       4       ParseComplete
2024-04-08 18:23:11.283800      B       4       BindComplete
2024-04-08 18:23:11.283801      B       37      RowDescription   1 
"udsi_user_id" 25071 1 1043 65535 24 0
2024-04-08 18:23:11.283803      B       14      DataRow  1 4 'mike'
2024-04-08 18:23:11.283804      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.283805      B       5       ReadyForQuery    T
2024-04-08 18:23:11.283970      F       425     Query    "select 
ns.nspname||'.'||substring(pg_get_expr(a.adbin,0) from 'nextval.''([^'']*)') 
seqname , c.attname from pg_class p join pg_attrdef a   on (p.oid=a.adrelid) 
join pg_attribute c   on (p.oid=c.attrelid and a.adnum=c.attnum) join 
pg_namespace ns   on (p.relnamespace=ns.oid) where 
upper(p.relname)=upper('book') and pg_get_expr(a.adbin,0) like 'nextval%' and 
(ns.nspname=current_schema()  or ns.oid=pg_my_temp_schema())"
2024-04-08 18:23:11.284943      B       58      RowDescription   2 "seqname" 0 
0 25 65535 -1 0 "attname" 1249 2 19 64 -1 0
2024-04-08 18:23:11.284947      B       44      DataRow  2 23 
'public.book_book_id_seq' 7 'book_id'
2024-04-08 18:23:11.284948      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.284949      B       5       ReadyForQuery    T
2024-04-08 18:23:11.285120      F       370     Parse    "cu1" "insert into 
book (b_title, b_author, b_isbn, b_pub_date, b_price, b_plot, boo_mtime, 
boo_muser, boo_mstat) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) returning 
book.book_id, (select case when book.book_id>(select last_value from 
public.book_book_id_seq) then 
setval('public.book_book_id_seq',book.book_id,true) else 0 end)" 9 1043 23 1043 
1082 1700 1043 1114 1043 1042
2024-04-08 18:23:11.285122      F       4       Sync
2024-04-08 18:23:11.285263      B       4       ParseComplete
2024-04-08 18:23:11.285264      B       5       ReadyForQuery    T
2024-04-08 18:23:11.285266      F       123     Bind     "" "cu1" 9 0 0 0 0 0 0 
0 0 0 9 3 'EEE' 3 '100' 2 '44' 10 '2024-04-08' 4 '0.00' -1 26 '2024-04-08 
16:23:11.281000' 4 'mike' -1 1 0
2024-04-08 18:23:11.285268      F       6       Describe         P ""
2024-04-08 18:23:11.285269      F       9       Execute  "" 0
2024-04-08 18:23:11.285270      F       4       Sync
2024-04-08 18:23:11.285480      B       4       BindComplete
2024-04-08 18:23:11.285490      B       55      RowDescription   2 "book_id" 
25034 1 23 4 -1 0 "case" 0 0 20 8 -1 0
2024-04-08 18:23:11.285515      B       194     ErrorResponse    S "ERROR" V 
"ERROR" C "23505" M "duplicate key value violates unique constraint 
"book_b_isbn_key"" D "Key (b_isbn)=(44) already exists." s "public" t "book" n 
"book_b_isbn_key" F "nbtinsert.c" L "666" R "_bt_check_unique" \x00
2024-04-08 18:23:11.285520      B       5       ReadyForQuery    E
2024-04-08 18:23:11.285608      F       19      Query    "deallocate cu1"
2024-04-08 18:23:11.285641      B       144     ErrorResponse    S "ERROR" V 
"ERROR" C "25P02" M "current transaction is aborted, commands ignored until end 
of transaction block" F "postgres.c" L "1136" R "exec_simple_query" \x00
2024-04-08 18:23:11.285646      B       5       ReadyForQuery    E
2024-04-08 18:23:11.285695      F       19      Query    "deallocate cu0"
2024-04-08 18:23:11.285717      B       144     ErrorResponse    S "ERROR" V 
"ERROR" C "25P02" M "current transaction is aborted, commands ignored until end 
of transaction block" F "postgres.c" L "1136" R "exec_simple_query" \x00
2024-04-08 18:23:11.285722      B       5       ReadyForQuery    E
2024-04-08 18:23:11.285731      F       13      Query    "rollback"
2024-04-08 18:23:11.285751      B       13      CommandComplete  "ROLLBACK"
2024-04-08 18:23:11.285752      B       5       ReadyForQuery    I
2024-04-08 18:23:11.285789      F       10      Query    "begin"
2024-04-08 18:23:11.285807      B       10      CommandComplete  "BEGIN"
2024-04-08 18:23:11.285809      B       5       ReadyForQuery    T
2024-04-08 18:23:11.285839      F       19      Query    "deallocate cu0"
2024-04-08 18:23:11.285857      B       15      CommandComplete  "DEALLOCATE"
2024-04-08 18:23:11.285859      B       5       ReadyForQuery    T
2024-04-08 18:23:11.285927      F       250     Parse    "cu0" "declare srv_cu0 
cursor for select udsi_table_name, udsi_last_mtime, udsi_temp_mtime, 
udsi_can_insert, udsi_can_update, udsi_can_delete, udsi_where_part, 
udsi_position from   dbsync_udsinfo where udsi_user_id = $1 order by 
udsi_position" 1 1043
2024-04-08 18:23:11.285928      F       4       Sync
2024-04-08 18:23:11.285967      B       4       ParseComplete
2024-04-08 18:23:11.285969      B       5       ReadyForQuery    T
2024-04-08 18:23:11.285970      F       27      Bind     "" "cu0" 1 0 1 4 
'mike' 1 0
2024-04-08 18:23:11.285971      F       6       Describe         P ""
2024-04-08 18:23:11.285972      F       9       Execute  "" 0
2024-04-08 18:23:11.285974      F       4       Sync
2024-04-08 18:23:11.286041      B       4       BindComplete
2024-04-08 18:23:11.286042      B       4       NoData
2024-04-08 18:23:11.286043      B       19      CommandComplete  "DECLARE 
CURSOR"
2024-04-08 18:23:11.286045      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286053      F       34      Query    "fetch absolute 0 from 
srv_cu0"
2024-04-08 18:23:11.286078      B       276     RowDescription   8 
"udsi_table_name" 25071 2 1043 65535 54 0 "udsi_last_mtime" 25071 8 1114 8 3 0 
"udsi_temp_mtime" 25071 9 1114 8 3 0 "udsi_can_insert" 25071 4 1042 65535 5 0 
"udsi_can_update" 25071 5 1042 65535 5 0 "udsi_can_delete" 25071 6 1042 65535 5 
0 "udsi_where_part" 25071 7 1043 65535 2004 0 "udsi_position" 25071 3 23 4 -1 0
2024-04-08 18:23:11.286082      B       12      CommandComplete  "FETCH 0"
2024-04-08 18:23:11.286083      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286112      F       34      Query    "fetch forward 50 from 
srv_cu0"
2024-04-08 18:23:11.286142      B       276     RowDescription   8 
"udsi_table_name" 25071 2 1043 65535 54 0 "udsi_last_mtime" 25071 8 1114 8 3 0 
"udsi_temp_mtime" 25071 9 1114 8 3 0 "udsi_can_insert" 25071 4 1042 65535 5 0 
"udsi_can_update" 25071 5 1042 65535 5 0 "udsi_can_delete" 25071 6 1042 65535 5 
0 "udsi_where_part" 25071 7 1043 65535 2004 0 "udsi_position" 25071 3 23 4 -1 0
2024-04-08 18:23:11.286146      B       71      DataRow  8 6 'author' 23 
'2024-04-08 12:59:40.765' -1 1 'Y' 1 'Y' 1 'Y' -1 1 '1'
2024-04-08 18:23:11.286147      B       69      DataRow  8 4 'book' 23 
'2024-04-08 12:59:40.765' -1 1 'Y' 1 'Y' 1 'Y' -1 1 '2'
2024-04-08 18:23:11.286149      B       12      CommandComplete  "FETCH 2"
2024-04-08 18:23:11.286150      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286242      F       34      Query    "fetch forward 50 from 
srv_cu0"
2024-04-08 18:23:11.286264      B       276     RowDescription   8 
"udsi_table_name" 25071 2 1043 65535 54 0 "udsi_last_mtime" 25071 8 1114 8 3 0 
"udsi_temp_mtime" 25071 9 1114 8 3 0 "udsi_can_insert" 25071 4 1042 65535 5 0 
"udsi_can_update" 25071 5 1042 65535 5 0 "udsi_can_delete" 25071 6 1042 65535 5 
0 "udsi_where_part" 25071 7 1043 65535 2004 0 "udsi_position" 25071 3 23 4 -1 0
2024-04-08 18:23:11.286267      B       12      CommandComplete  "FETCH 0"
2024-04-08 18:23:11.286269      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286318      F       18      Query    "close srv_cu0"
2024-04-08 18:23:11.286337      B       17      CommandComplete  "CLOSE CURSOR"
2024-04-08 18:23:11.286339      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286390      F       104     Parse    "" "update 
dbsync_udsinfo SET udsi_user_id = udsi_user_id WHERE udsi_table_name IN 
('author','book')" 0
2024-04-08 18:23:11.286391      F       14      Bind     "" "" 0 0 1 0
2024-04-08 18:23:11.286392      F       6       Describe         P ""
2024-04-08 18:23:11.286393      F       9       Execute  "" 0
2024-04-08 18:23:11.286394      F       4       Sync
2024-04-08 18:23:11.286463      B       4       ParseComplete
2024-04-08 18:23:11.286464      B       4       BindComplete
2024-04-08 18:23:11.286465      B       4       NoData
2024-04-08 18:23:11.286466      B       13      CommandComplete  "UPDATE 4"
2024-04-08 18:23:11.286468      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286512      F       106     Parse    "" "select 
udsi_user_id from   dbsync_udsinfo where udsi_user_id = $1 AND udsi_table_name 
= $2" 2 1043 1043
2024-04-08 18:23:11.286513      F       36      Bind     "" "" 2 0 0 2 4 'mike' 
6 'author' 1 0
2024-04-08 18:23:11.286515      F       6       Describe         P ""
2024-04-08 18:23:11.286516      F       9       Execute  "" 0
2024-04-08 18:23:11.286517      F       4       Sync
2024-04-08 18:23:11.286569      B       4       ParseComplete
2024-04-08 18:23:11.286570      B       4       BindComplete
2024-04-08 18:23:11.286572      B       37      RowDescription   1 
"udsi_user_id" 25071 1 1043 65535 24 0
2024-04-08 18:23:11.286573      B       14      DataRow  1 4 'mike'
2024-04-08 18:23:11.286574      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.286575      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286630      F       106     Parse    "" "select 
udsi_user_id from   dbsync_udsinfo where udsi_user_id = $1 AND udsi_table_name 
= $2" 2 1043 1043
2024-04-08 18:23:11.286631      F       34      Bind     "" "" 2 0 0 2 4 'mike' 
4 'book' 1 0
2024-04-08 18:23:11.286632      F       6       Describe         P ""
2024-04-08 18:23:11.286633      F       9       Execute  "" 0
2024-04-08 18:23:11.286635      F       4       Sync
2024-04-08 18:23:11.286680      B       4       ParseComplete
2024-04-08 18:23:11.286681      B       4       BindComplete
2024-04-08 18:23:11.286683      B       37      RowDescription   1 
"udsi_user_id" 25071 1 1043 65535 24 0
2024-04-08 18:23:11.286684      B       14      DataRow  1 4 'mike'
2024-04-08 18:23:11.286685      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.286686      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286732      F       19      Query    "deallocate cu0"
2024-04-08 18:23:11.286752      B       15      CommandComplete  "DEALLOCATE"
2024-04-08 18:23:11.286753      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286821      F       250     Parse    "cu0" "declare srv_cu0 
cursor for select udsi_table_name, udsi_last_mtime, udsi_temp_mtime, 
udsi_can_insert, udsi_can_update, udsi_can_delete, udsi_where_part, 
udsi_position from   dbsync_udsinfo where udsi_user_id = $1 order by 
udsi_position" 1 1043
2024-04-08 18:23:11.286822      F       4       Sync
2024-04-08 18:23:11.286853      B       4       ParseComplete
2024-04-08 18:23:11.286854      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286856      F       27      Bind     "" "cu0" 1 0 1 4 
'mike' 1 0
2024-04-08 18:23:11.286857      F       6       Describe         P ""
2024-04-08 18:23:11.286858      F       9       Execute  "" 0
2024-04-08 18:23:11.286859      F       4       Sync
2024-04-08 18:23:11.286899      B       4       BindComplete
2024-04-08 18:23:11.286900      B       4       NoData
2024-04-08 18:23:11.286901      B       19      CommandComplete  "DECLARE 
CURSOR"
2024-04-08 18:23:11.286902      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286904      F       34      Query    "fetch absolute 0 from 
srv_cu0"
2024-04-08 18:23:11.286925      B       276     RowDescription   8 
"udsi_table_name" 25071 2 1043 65535 54 0 "udsi_last_mtime" 25071 8 1114 8 3 0 
"udsi_temp_mtime" 25071 9 1114 8 3 0 "udsi_can_insert" 25071 4 1042 65535 5 0 
"udsi_can_update" 25071 5 1042 65535 5 0 "udsi_can_delete" 25071 6 1042 65535 5 
0 "udsi_where_part" 25071 7 1043 65535 2004 0 "udsi_position" 25071 3 23 4 -1 0
2024-04-08 18:23:11.286928      B       12      CommandComplete  "FETCH 0"
2024-04-08 18:23:11.286929      B       5       ReadyForQuery    T
2024-04-08 18:23:11.286953      F       34      Query    "fetch forward 50 from 
srv_cu0"
2024-04-08 18:23:11.286982      B       276     RowDescription   8 
"udsi_table_name" 25071 2 1043 65535 54 0 "udsi_last_mtime" 25071 8 1114 8 3 0 
"udsi_temp_mtime" 25071 9 1114 8 3 0 "udsi_can_insert" 25071 4 1042 65535 5 0 
"udsi_can_update" 25071 5 1042 65535 5 0 "udsi_can_delete" 25071 6 1042 65535 5 
0 "udsi_where_part" 25071 7 1043 65535 2004 0 "udsi_position" 25071 3 23 4 -1 0
2024-04-08 18:23:11.286985      B       71      DataRow  8 6 'author' 23 
'2024-04-08 12:59:40.765' -1 1 'Y' 1 'Y' 1 'Y' -1 1 '1'
2024-04-08 18:23:11.286987      B       69      DataRow  8 4 'book' 23 
'2024-04-08 12:59:40.765' -1 1 'Y' 1 'Y' 1 'Y' -1 1 '2'
2024-04-08 18:23:11.286988      B       12      CommandComplete  "FETCH 2"
2024-04-08 18:23:11.286989      B       5       ReadyForQuery    T
2024-04-08 18:23:11.287084      F       34      Query    "fetch forward 50 from 
srv_cu0"
2024-04-08 18:23:11.287104      B       276     RowDescription   8 
"udsi_table_name" 25071 2 1043 65535 54 0 "udsi_last_mtime" 25071 8 1114 8 3 0 
"udsi_temp_mtime" 25071 9 1114 8 3 0 "udsi_can_insert" 25071 4 1042 65535 5 0 
"udsi_can_update" 25071 5 1042 65535 5 0 "udsi_can_delete" 25071 6 1042 65535 5 
0 "udsi_where_part" 25071 7 1043 65535 2004 0 "udsi_position" 25071 3 23 4 -1 0
2024-04-08 18:23:11.287107      B       12      CommandComplete  "FETCH 0"
2024-04-08 18:23:11.287108      B       5       ReadyForQuery    T
2024-04-08 18:23:11.287154      F       18      Query    "close srv_cu0"
2024-04-08 18:23:11.287172      B       17      CommandComplete  "CLOSE CURSOR"
2024-04-08 18:23:11.287174      B       5       ReadyForQuery    T
2024-04-08 18:23:11.287250      F       109     Parse    "" "select 
udsi_where_part from   dbsync_udsinfo where udsi_user_id = $1 AND 
udsi_table_name = $2" 2 1043 1043
2024-04-08 18:23:11.287252      F       36      Bind     "" "" 2 0 0 2 4 'mike' 
6 'author' 1 0
2024-04-08 18:23:11.287253      F       6       Describe         P ""
2024-04-08 18:23:11.287254      F       9       Execute  "" 0
2024-04-08 18:23:11.287255      F       4       Sync
2024-04-08 18:23:11.287307      B       4       ParseComplete
2024-04-08 18:23:11.287308      B       4       BindComplete
2024-04-08 18:23:11.287310      B       40      RowDescription   1 
"udsi_where_part" 25071 7 1043 65535 2004 0
2024-04-08 18:23:11.287311      B       10      DataRow  1 -1
2024-04-08 18:23:11.287312      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.287313      B       5       ReadyForQuery    T
2024-04-08 18:23:11.287395      F       109     Parse    "" "select 
udsi_where_part from   dbsync_udsinfo where udsi_user_id = $1 AND 
udsi_table_name = $2" 2 1043 1043
2024-04-08 18:23:11.287396      F       34      Bind     "" "" 2 0 0 2 4 'mike' 
4 'book' 1 0
2024-04-08 18:23:11.287398      F       6       Describe         P ""
2024-04-08 18:23:11.287399      F       9       Execute  "" 0
2024-04-08 18:23:11.287400      F       4       Sync
2024-04-08 18:23:11.287468      B       4       ParseComplete
2024-04-08 18:23:11.287470      B       4       BindComplete
2024-04-08 18:23:11.287471      B       40      RowDescription   1 
"udsi_where_part" 25071 7 1043 65535 2004 0
2024-04-08 18:23:11.287472      B       10      DataRow  1 -1
2024-04-08 18:23:11.287473      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.287475      B       5       ReadyForQuery    T
2024-04-08 18:23:11.287536      F       109     Parse    "" "select 
udsi_where_part from   dbsync_udsinfo where udsi_user_id = $1 AND 
udsi_table_name = $2" 2 1043 1043
2024-04-08 18:23:11.287538      F       36      Bind     "" "" 2 0 0 2 4 'mike' 
6 'author' 1 0
2024-04-08 18:23:11.287539      F       6       Describe         P ""
2024-04-08 18:23:11.287540      F       9       Execute  "" 0
2024-04-08 18:23:11.287541      F       4       Sync
2024-04-08 18:23:11.287583      B       4       ParseComplete
2024-04-08 18:23:11.287584      B       4       BindComplete
2024-04-08 18:23:11.287585      B       40      RowDescription   1 
"udsi_where_part" 25071 7 1043 65535 2004 0
2024-04-08 18:23:11.287587      B       10      DataRow  1 -1
2024-04-08 18:23:11.287588      B       13      CommandComplete  "SELECT 1"
2024-04-08 18:23:11.287589      B       5       ReadyForQuery    T
2024-04-08 18:23:11.287684      F       61      Parse    "cu1" "declare srv_cu1 
cursor for select * from   author " 0
2024-04-08 18:23:11.287686      F       4       Sync
2024-04-08 18:23:11.287747      B       107     ErrorResponse    S "ERROR" V 
"ERROR" C "42P05" M "prepared statement "cu1" already exists" F "prepare.c" L 
"412" R "StorePreparedStatement" \x00
2024-04-08 18:23:11.287755      B       5       ReadyForQuery    E
2024-04-08 18:23:11.287804      F       19      Query    "deallocate cu0"
2024-04-08 18:23:11.287827      B       144     ErrorResponse    S "ERROR" V 
"ERROR" C "25P02" M "current transaction is aborted, commands ignored until end 
of transaction block" F "postgres.c" L "1136" R "exec_simple_query" \x00
2024-04-08 18:23:11.287831      B       5       ReadyForQuery    E
2024-04-08 18:23:11.287840      F       13      Query    "rollback"
2024-04-08 18:23:11.287861      B       13      CommandComplete  "ROLLBACK"
2024-04-08 18:23:11.287862      B       5       ReadyForQuery    I
2024-04-08 18:23:11.287912      F       19      Query    "deallocate cu0"
2024-04-08 18:23:11.287932      B       15      CommandComplete  "DEALLOCATE"
2024-04-08 18:23:11.287933      B       5       ReadyForQuery    I
2024-04-08 18:23:11.287937      F       4       Terminate

Reply via email to