user10607
user10607

Reputation: 3071

How to delete a PGPing result from PostgreSQL's libpq?

I am using the c interface to PostgreSQL, libpq.

If I do PQping() on the database, how do I free/delete the returned PGPing instance (to avoid memory leaks)?

Is there something like PQclear() but for PGPing instead of PGresult?

Upvotes: 1

Views: 554

Answers (1)

Craig Ringer
Craig Ringer

Reputation: 324751

You don't.

The PGPing return value is just an enumerated value. There's nothing to free.

From src/interfaces/libpq/libpq-fe.h:

typedef enum
{
    PQPING_OK,                  /* server is accepting connections */
    PQPING_REJECT,              /* server is alive but rejecting connections */
    PQPING_NO_RESPONSE,         /* could not establish connection */
    PQPING_NO_ATTEMPT           /* connection not attempted (bad params) */
} PGPing;

Upvotes: 1

Related Questions