Re: dblink: could not send query: another command is already inprogress - Mailing list pgsql-general

From Laurenz Albe
Subject Re: dblink: could not send query: another command is already inprogress
Date
Msg-id 1522401246.2396.16.camel@cybertec.at
Whole thread Raw
In response to Re: dblink: could not send query: another command is already inprogress  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
Responses Re: dblink: could not send query: another command is already inprogress  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
List pgsql-general
Thiemo Kellner wrote:
> The cause of the error message is clear; as the documentation says:
> 
> >    the query will fail soon. You must still complete the normal query protocol,
> >    for example by calling dblink_get_result.
> 
> Ah, maybe this is the underlying problem. If dblink requires that 
> results get retrieved by dblink_get_result before the dblink is actually 
> ready to receive another query, it would explain the error I get. 
> However, I feel than the result of dblink_is_busy is faulty, 
> counter-intuitive or just useless in that context. Or I just 
> misinterpreted documentation: "checks if connection is busy with an 
> async query"
> 
> My understand there is that the actual query is still being processed, 
> the gathering of the results. I did not count the keeping of the result 
> as part of the query.

That is a misunderstanding.

If the connection is "busy", that means that the asynchronous query
is still busy receiving a result from the server.

Once it is no longer busy, a result has arrived and is ready to be
consumed.

You have to consume the result before you can send the next query.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com


pgsql-general by date:

Previous
From: Thiemo Kellner
Date:
Subject: Re: dblink: could not send query: another command is already inprogress
Next
From: Achilleas Mantzios
Date:
Subject: Re: Question about buffers_alloc in pg_stat_bgwriter view formonitoring