Re: BackendKeyData is mandatory? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: BackendKeyData is mandatory?
Date
Msg-id 1846938.1754661665@sss.pgh.pa.us
Whole thread Raw
In response to Re: BackendKeyData is mandatory?  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: BackendKeyData is mandatory?
List pgsql-hackers
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> I noticed that there's a similar, existing case in getNotify(), where 
> libpq just hangs if an allocation fails. To simulate that, apply this 
> change and use LISTEN/NOTIFY:

> --- a/src/interfaces/libpq/fe-protocol3.c
> +++ b/src/interfaces/libpq/fe-protocol3.c
> @@ -1587,7 +1587,7 @@ getNotify(PGconn *conn)
>       if (pqGets(&conn->workBuffer, conn))
>           return EOF;
>       /* must save name while getting extra string */
> -    svname = strdup(conn->workBuffer.data);
> +    svname = NULL;
>       if (!svname)
>           return EOF;
>       if (pqGets(&conn->workBuffer, conn))

> Returning EOF means "not enough data", which is wrong here just like in 
> getBackendKeyData().

The implication of "return EOF" is "try again later", which seems like
about the best thing we can do.  If memory serves, other places that
construct query results do likewise.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Fabrice Chapuis
Date:
Subject: Re: Issue with logical replication slot during switchover
Next
From: Heikki Linnakangas
Date:
Subject: Re: BackendKeyData is mandatory?