Fixes possible api misuse when connecting with server

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fixes possible api misuse when connecting with server
Date: 2025-06-23 14:46:05
Message-ID: CAEudQApidV8rwY=9m8vGVf6TmNhfnWy1GqYs=iFCAEvZGrNXHQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

IMO, I think that some sources can have api misuse.

The functions * PQconnectdbParams* and * PQconnectdb*,
can return NULL and need a handler too.
More, if a connection fail with CONNECTION_BAD, some
sources do not handle correctly when failing.
Must call PQfinish, to release OS resources.

Patches attached.

best regards,
Ranier Vilela

Attachment Content-Type Size
fix-connection-api-miuse-connect_utils.patch application/octet-stream 652 bytes
fix-connection-api-miuse-ecpg.patch application/octet-stream 596 bytes
fix-connection-api-miuse-pg_rewind.patch application/octet-stream 612 bytes
fix-connection-api-miuse-psql.patch application/octet-stream 411 bytes
fix-connection-api-miuse-pg_createsubscriber.patch application/octet-stream 598 bytes

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2025-06-23 14:48:27 Re: pgsql: Introduce pg_shmem_allocations_numa view
Previous Message Christoph Berg 2025-06-23 14:42:26 Re: pgsql: Introduce pg_shmem_allocations_numa view