pgsql: Use StringInfo to build the result in oidvectortypes()

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use StringInfo to build the result in oidvectortypes()
Date: 2026-10-15 13:52:10
Message-ID: E1xHLsQ-00000001k1J-3WUD@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use StringInfo to build the result in oidvectortypes()

Replace manual buffer management with StringInfo to avoid repeatedly
scanning the accumulated output when appending type names. This
removes quadratic scanning for large input vectors and simplifies the
code.

Also check for interrupts in the loop and free temporary type names
after appending them to the result.

Author: Chao Li <lic(at)highgo(dot)com>
Reviewed-by: Japin Li <japinli(at)hotmail(dot)com>
Reviewed-by: David Rowley <dgrowleyml(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/70611808-81DA-4B99-A3DB-7371F7EA4702@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a999971331301a4a2f945220733b11af90cc2962

Modified Files
--------------
src/backend/utils/adt/format_type.c | 36 +++++++++++++-----------------------
1 file changed, 13 insertions(+), 23 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-10-15 14:31:29 pgsql: Modernize our parsing of XML data in CONTENT mode.
Previous Message Heikki Linnakangas 2026-10-15 09:35:27 pgsql: Fix CreateThread() failure checks