Re: Cleaning up PREPARE query strings?

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Cleaning up PREPARE query strings?
Date: 2026-08-06 09:40:08
Message-ID: CAF0whucxZ_BzeHROewBa=fhFpx53_Eveb5Tnzk0k3ns5n95xXw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I reviewed and tested
v4-0001-Clean-up-PREPARE-query-strings-in-multi-statement.patch on the
current master branch.
The patch applied cleanly, PostgreSQL built successfully, and the
server started without any issues.

I tested the main functionality using multiple prepared statements:
PREPARE s1 AS SELECT 1;
PREPARE s2(text) AS SELECT oid FROM pg_class WHERE relname=$1;
PREPARE s3(int,int) AS SELECT $1+$2;
SELECT name, statement FROM pg_prepared_statements;

The output was:

name | statement
------+---------------------------------------------------------------
s1 | PREPARE s1 AS SELECT 1
s2 | PREPARE s2(text) AS SELECT oid FROM pg_class WHERE relname=$1
s3 | PREPARE s3(int,int) AS SELECT $1+$2

I then executed all three prepared statements:
EXECUTE s1;
EXECUTE s2('pg_class');
EXECUTE s3(10,20);

The results were as expected:
s1 -> 1
s2 -> 1259
s3 -> 30

I also checked error reporting with:
PREPARE stmt AS
SELECT nonexistent_column
FROM users;
The server reported:
ERROR: relation "users" does not exist
LINE 3: FROM users;
^

The error cursor pointed to the expected location, and I didn't
observe any regressions in the scenarios I tested.
I wasn't able to test the pg_stat_statements scenario because my local
setup has a version mismatch between the PostgreSQL 20devel server and
the installed pg_stat_statements library.

Overall, the patch applied cleanly and worked as expected in the
scenarios I tested.
Thanks for working on this patch.

Regards,
solai

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mihail Nikalayeu 2026-08-06 10:08:01 Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements
Previous Message Amit Kapila 2026-08-06 09:12:36 Re: [bug fix] prepared transaction might be lost when max_prepared_transactions is zero on the subscriber