1

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?

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
user10607
  • 3,011
  • 4
  • 24
  • 31

1 Answers1

1

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;
Craig Ringer
  • 307,061
  • 76
  • 688
  • 778