Re: dblink: could not send query: another command is already in progress

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: dblink: could not send query: another command is already in progress
Date: 2018-03-30 09:14:06
Message-ID: 1522401246.2396.16.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Achilleas Mantzios 2018-03-30 09:50:25 Re: Question about buffers_alloc in pg_stat_bgwriter view for monitoring
Previous Message Thiemo Kellner 2018-03-30 07:59:12 Re: dblink: could not send query: another command is already in progress