Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wMndq-000LxD-14 for pgsql-bugs@arkaria.postgresql.org; Tue, 12 May 2026 13:59:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wMndn-004pbF-15 for pgsql-bugs@arkaria.postgresql.org; Tue, 12 May 2026 13:59:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wMndm-004pb6-37 for pgsql-bugs@lists.postgresql.org; Tue, 12 May 2026 13:59:19 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wMndk-00000000D8m-3Tg7 for pgsql-bugs@lists.postgresql.org; Tue, 12 May 2026 13:59:18 +0000 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-50d6b9bca48so67142071cf.2 for ; Tue, 12 May 2026 06:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778594356; cv=none; d=google.com; s=arc-20240605; b=Wjb4ey6lbcanmCQX+QaNHPof6s/r910KxuMIp0eExZxszlWe4S8H7jKtrT8KCEV7gU 52sFgGAkoSgi3iFHBm3UHeeozjZSt22XSg1JxhorLyiiFu5ApjWPbp1c8EWCpKtCIaa+ gfDuRTA8L86n4b0C8VSw9mLBw3Jn5tFay3gtmWbx8gv2rygbjA8T82jzdXVVhEwO8wpv BIgl0urw7SLhED7jKblemvwRRylqw1o7TUrEwE1LYXA5Zv/kb4Zih5n+3o1cyw88nDEu d2UhBLyAaa07uWF9xJwY3eambAFE/OoG7Itrt/HYvf6xkwAoqPujy4SQOYMiXQL36t13 Vglw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=z03uut0aW70yg1rP2GYeiLLoFI6tFhfNJhjVeEB1z80=; fh=GkSQ+ATtB4FEwESjxGVJ1C/jT+MuoNhDnBsyfBzfUGY=; b=eVqSJ6BsjIk1IocCVQfEfrw9Nu00RdHk06Q/Jw1xf5Ckvwhc6vNtJwzyWNf5uq390F +cDY/sPp6V32gnyw8WrNz5dmRmDBXdkAKmvbM3E+0pAUNfa8P3A5x6X+xW7fVVO61ggu PlRfg2o2UkPGxQ7qD3JsEISs5F4awQO8bV0qsR/vTsGjx5jnYFHfyz0C0r3qE6sT+6MT fW8EKZd/VPYJSbBRX5UIbQwn8KOr+Q8e4Q0iGTnMKU4yKJcVqf9+uRzhDN2cCE9H2wsL RI1BC1/xW2NMGXqlfl7doAv/D26dpJoWTL2BBdvjCqUNGm0UBQ4ufQ4M2F7Jd+XhSsk1 DlWw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778594356; x=1779199156; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=z03uut0aW70yg1rP2GYeiLLoFI6tFhfNJhjVeEB1z80=; b=WytT6userV1tpm+qvoANVYkQ4ugUHdIKtqDuhTy8A1V/kFFGaZXrGsl7ohOSDb5TGV haOz+o8XPkKT2Cy2MajQpjaNrXSsqry+ZnctZ1DE0djBCMyqMmozPiuiVyni21paWDfB DSpVe+0aKTu4yRc5Jx1NzYa50S049dNqemH0FPIKLLCeoB3m6cZOI4+gbbAh5M2eJYxG Ao5RktFZeouQwtVhz7YQcVECYgIpcfzeumSyWXFMMQFmLs4E5UXdlSPMlMAkLcgtfheU gyqb/APmva27ZyTIKmbA22zm3pZ2PY7WuCapjLcokwevnGQ2RRtiFIl9ee/oEkXp5q5C ombw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778594356; x=1779199156; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=z03uut0aW70yg1rP2GYeiLLoFI6tFhfNJhjVeEB1z80=; b=SQDJoRZ2lKwbtrrE1WrlOs3Anr16L/YOkNYl5Mjt+X2MvdXbzSXpJZKySKFmcFTj86 04GSTYRLS4XYAyCVySB59H9Za7Zl62vx2CDAdsIHeyXVnZfy1NaM7VMhH7OYypJ/zkgM FbaJiHn7q2dQMVTRrE/8ArkFkKXlGxJNldmJzFilVTAplCqE7rzH6RbdfSK3GLduxo0B nMJZ7NJ0HAizUkPXKc7EbrBN6jBYSLhnW594yi3ZQZeh/a6q7EJ9TDe/9TWXgXS7rCPb 6gRzN6/1TCz0l0m8QWdgTtDrLzqR9UilRL7FYwP6u2meeLYZCWcfCRhiG1/RUzr1uQcw Ch3Q== X-Forwarded-Encrypted: i=1; AFNElJ9xqnfXor3hI/LzYXwQq8JYPvjFoLQS+07W7hnp+P9IMmuvk2gOgyMN8fjrhyi+I3d07GQRqan2LFzD@lists.postgresql.org X-Gm-Message-State: AOJu0Yymli5eKUHf/agDetB7oDiWQDrhwXd0yTuwaaoC06rQhT7SkORW GJ7IjaSXcrvzJtGQ+MXvKEr5CFTD8VQdXI75R+6PhVV622gG95q0vLOvotK+IVpdfplGe1QCuEV YsDT+LEq5YTmgNU+CRAnbA7OkhG1/04c= X-Gm-Gg: Acq92OHgE3RyJu5uaQTTQd6FDlDDnErvVqFZLcgD4p1/hbJLqyeJqU93dUnx3M0+ysS JyHMC6wJh4mFseULoanfBxYLWz6zNnrbp+Pziwr6WcbcS5fjJPHU0AzJhvWjCDujEz6qyoe6zEm 2khzu8FHGeYRRFOmPZlLMbM7rB00WnbDAXS+3yZrEVev5SaRgLLBVBCTXr54amn9s+e5wwkHlW9 FIcrM5t15XR/TonZQTcwqZ7CkXvBhCpQJQxVvHJRgxONskjde3oPXNYuyRC2PUrh6RI+UgxiRGZ NLwVhbghDYHcwEhMKAzGIK+tBAWVkn1va5IRiu46cegPsObwvLku/v32dUugXDmGRob6GkuNZoq IEsTGiN8O0Ee2INGR6CA= X-Received: by 2002:ac8:5703:0:b0:50e:578e:bb18 with SMTP id d75a77b69052e-514d222262dmr42851781cf.47.1778594356336; Tue, 12 May 2026 06:59:16 -0700 (PDT) MIME-Version: 1.0 References: <19473-92f01422b9220412@postgresql.org> In-Reply-To: From: Kirill Reshke Date: Tue, 12 May 2026 18:59:03 +0500 X-Gm-Features: AVHnY4LM8RyVWQ0b_70IJJym_PEQvZZqQAoUvOhC-qpaQ6nymn5JWyjeANd9_ZE Message-ID: Subject: Re: BUG #19473: regression error in dblink: another command is already in progress To: Fujii Masao Cc: o15611@gmail.com, PostgreSQL mailing lists Content-Type: multipart/alternative; boundary="000000000000cf1a0a06519f44d2" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000cf1a0a06519f44d2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 12 May 2026, 18:47 Fujii Masao, wrote: > On Sat, May 9, 2026 at 4:43=E2=80=AFAM PG Bug reporting form > wrote: > > > > The following bug has been logged on the website: > > > > Bug reference: 19473 > > Logged by: Oleg Ivanov > > Email address: o15611@gmail.com > > PostgreSQL version: 18.3 > > Operating system: Linux > > Description: > > > > Testcase: > > SELECT * FROM dblink('dbname=3Dpostgres user=3Dpostgres', $$ select 7; = $$ ) > as > > (col1 int); > > SELECT * FROM dblink_connect('connection1', 'host=3D/var/run/postgresql > > port=3D5432'); > > SELECT * FROM dblink_send_query('connection1', $$ select 8 from > pg_sleep(1); > > $$ ); > > SELECT dblink_is_busy('connection1'); > > SELECT * FROM dblink_get_result('connection1') as t(col1 int); > > --- SELECT dblink_is_busy('connection1'); > > SELECT * FROM dblink_exec('connection1', $$ CHECKPOINT; $$); > > SELECT * FROM dblink_disconnect('connection1'); > > > > col1 > > ------ > > 7 > > (1 row) > > > > dblink_connect > > ---------------- > > OK > > (1 row) > > > > dblink_send_query > > ------------------- > > 1 > > (1 row) > > > > dblink_is_busy > > ---------------- > > 1 > > (1 row) > > > > col1 > > ------ > > 8 > > (1 row) > > > > ERROR: another command is already in progress > > CONTEXT: while executing command on dblink connection named > "connection1" > > dblink_disconnect > > ------------------- > > OK > > (1 row) > > > > There was no error in 16 version. The error appeared in 17 version. It > > seems, there is a regression bug. > > The workaround is to uncomment a commented statement. > > The documentation for dblink_get_result() notes "It must be called once f= or > each query sent, and one additional time to obtain an empty set result, > before the connection can be used again". So in your case, it seems that > dblink_get_result() needs to be called one more time before calling > dblink_exec(). If you do that, I think that the error "another command is > already in progress" should not occur. Therefore, this does not seem to b= e > a bug to me. Thought? > > Regards, > > -- > Fujii Masao > Doesn't dblink_is_busy violates this doc then? I mean, dblink_is_busy has side effect of changing connection state. Is this OK? > --000000000000cf1a0a06519f44d2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, 12 May 2026, 18:47 Fujii= Masao, <masao.fujii@gmail.com<= /a>> wrote:
On Sat, May 9, 2026 = at 4:43=E2=80=AFAM PG Bug reporting form
<
noreply@postgresql.org> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference:=C2=A0 =C2=A0 =C2=A0 19473
> Logged by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Oleg Ivanov
> Email address:=C2=A0 =C2=A0 =C2=A0 o15611@gmail.com
> PostgreSQL version: 18.3
> Operating system:=C2=A0 =C2=A0Linux
> Description:
>
> Testcase:
> SELECT * FROM dblink('dbname=3Dpostgres user=3Dpostgres', $$ s= elect 7; $$ ) as
> (col1 int);
> SELECT * FROM dblink_connect('connection1', 'host=3D/var/r= un/postgresql
> port=3D5432');
> SELECT * FROM dblink_send_query('connection1', $$ select 8 fro= m pg_sleep(1);
> $$ );
> SELECT dblink_is_busy('connection1');
> SELECT * FROM dblink_get_result('connection1') as t(col1 int);=
> --- SELECT dblink_is_busy('connection1');
> SELECT * FROM dblink_exec('connection1', $$ CHECKPOINT; $$); > SELECT * FROM dblink_disconnect('connection1');
>
>=C2=A0 col1
> ------
>=C2=A0 =C2=A0 =C2=A07
> (1 row)
>
>=C2=A0 dblink_connect
> ----------------
>=C2=A0 OK
> (1 row)
>
>=C2=A0 dblink_send_query
> -------------------
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1
> (1 row)
>
>=C2=A0 dblink_is_busy
> ----------------
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A01
> (1 row)
>
>=C2=A0 col1
> ------
>=C2=A0 =C2=A0 =C2=A08
> (1 row)
>
> ERROR:=C2=A0 another command is already in progress
> CONTEXT:=C2=A0 while executing command on dblink connection named &quo= t;connection1"
>=C2=A0 dblink_disconnect
> -------------------
>=C2=A0 OK
> (1 row)
>
> There was no error in 16 version. The error appeared in 17 version. It=
> seems, there is a regression bug.
> The workaround is to uncomment a commented statement.

The documentation for dblink_get_result() notes "It must be called onc= e for
each query sent, and one additional time to obtain an empty set result,
before the connection can be used again". So in your case, it seems th= at
dblink_get_result() needs to be called one more time before calling
dblink_exec(). If you do that, I think that the error "another command= is
already in progress" should not occur. Therefore, this does not seem t= o be
a bug to me. Thought?

Regards,

--
Fujii Masao


Doesn't dblink_is_busy violates = this doc then? I mean, dblink_is_busy has side effect of changing connectio= n state. Is this OK?
--000000000000cf1a0a06519f44d2--