Re: Lifetime of PQexecPrepared() returned value

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Lifetime of PQexecPrepared() returned value
Date: 2017-08-05 18:30:03
Message-ID: 6665.1501957803@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Igor Korot <ikorot01(at)gmail(dot)com> writes:
> However it leads to another question - should PQclear set the pointer to NULL?

C doesn't provide any reasonable way to do that. The argument of PQclear
needn't even be an lvalue; for example, if you're not too concerned about
error checking, it's not unreasonable to write

PQclear(PQexec(conn, "some SQL command"));

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dan Cooperstock at Software4Nonprofits 2017-08-05 20:09:49 PostgreSQL with PowerBuilder, and Identity keys (serials)
Previous Message Igor Korot 2017-08-05 18:01:10 Re: Invalid byte sequence for encoding UTF-8 0xc3\n