Arturs Zoldners <az@rpiva.lv> writes:
> The following code raises SIGSEGV:
> PGconn* conn = PQconnectdb("x");
> ConnStatusType status = PQstatus(conn);
> //status == CONNECTION_BAD
> PQreset(conn);
PQreset assumes it's been passed a reasonably valid PGconn, which is not
the case if conninfo_parse couldn't make any sense of the connect
options string. We probably ought to add a state flag to indicate
whether the options have been set up successfully, and cause PQreset to
fail if not. (The alternative seems to be for PQreset to refuse to do
anything if the connection state is CONNECTION_BAD, but that looks like
it would destroy most of the usefulness of PQreset ...)
regards, tom lane