Обсуждение: Why are we using blocking libpq in the backend?

Поиск
Список
Период
Сортировка

Why are we using blocking libpq in the backend?

От
Andres Freund
Дата:
Hi,

As noted in [1], and also commented on by other previously, we use libpq in
blocking mode in libpqwalreceiver, postgres_fdw, etc.  This is done knowingly,
see e.g. comments like:
    /*
     * Submit the query.  Since we don't use non-blocking mode, this could
     * theoretically block.  In practice, since we don't send very long query
     * strings, the risk seems negligible.
     */

but I don't understand why we do it. It seems like it'd be a fairly small
amount of additional code to just do it right, given that we do so for calls
to PQgetResult() etc?

Greetings,

Andres Freund

[1] https://postgr.es/m/20230103200520.di5hjebqvi72coql%40awork3.anarazel.de