Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nnys0-0000oC-D4 for pgsql-bugs@arkaria.postgresql.org; Mon, 09 May 2022 08:35:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nnyrx-0000qw-W4 for pgsql-bugs@arkaria.postgresql.org; Mon, 09 May 2022 08:35:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nnyrx-0000qn-HY for pgsql-bugs@lists.postgresql.org; Mon, 09 May 2022 08:35:53 +0000 Received: from mxe2.seznam.cz ([2a02:598:2::34]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nnyru-0006Zb-88 for pgsql-bugs@lists.postgresql.org; Mon, 09 May 2022 08:35:52 +0000 Received: from email.seznam.cz by email-smtpc10a.ng.seznam.cz (email-smtpc10a.ng.seznam.cz [10.23.11.45]) id 2503334c1d20d57025ea3f29; Mon, 09 May 2022 10:35:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=email.cz; s=beta; t=1652085346; bh=EMJNQNsQJcUm6vLa7PlcKg2ez5WECWsH80PNBs9I2P8=; h=Received:From:To:Cc:Subject:Date:Message-Id:References: Mime-Version:X-Mailer:Content-Type:X-szn-frgn:X-szn-frgc; b=Es5AMe6EIZHi6xWKiBy2w/TNYj4j/6wHHZvcaLUwbGd7JfF02iDYzN2mufGA4JCCy /NrYIJRs0+sVS1xk4Mus6oZzaeG+A7qBR6exBbMIgJkSo+bcQa0kfpSibzgrcbRFFj jTXeVXkdoC2/xe7K0p11/0kGjen8qXazS6AcijDs= Received: from 89-24-172-40.customers.tmcz.cz (89-24-172-40.customers.tmcz.cz [89.24.172.40]) by email.seznam.cz (szn-ebox-5.0.107) with HTTP; Mon, 09 May 2022 10:35:33 +0200 (CEST) From: =?utf-8?q?Milo=C5=A1_Urb=C3=A1nek?= To: "Pavel Stehule" Cc: "Tom Lane" , "PostgreSQL mailing lists" Subject: =?utf-8?q?Re=3A_BUG_=2317476=3A_ERROR=3A_=22variable_not_found_in?= =?utf-8?q?_subplan_target_list=22_when_running_SELECT_COUNT=28*=29?= Date: Mon, 09 May 2022 10:35:33 +0200 (CEST) Message-Id: <609.wBLt.62HW}58GAL}.1YUD9L@scif.cz> References: <17476-cf579fc6b204baa2@postgresql.org> <3488097.1652055721@sss.pgh.pa.us> <5wS.wBLd.2GdiEutIVdh.1YUC4K@scif.cz> Mime-Version: 1.0 (szn-mime-2.1.20) X-Mailer: szn-ebox-5.0.107 Content-Type: multipart/alternative; boundary="=_0953ed2c464e0acf1a513229=e8c3f721-ef72-5411-a9ee-f7f5baa70db1_=" X-szn-frgn: <6a8a1e14-7d18-411a-83d9-bf5ce11547dc> X-szn-frgc: <0> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=_0953ed2c464e0acf1a513229=e8c3f721-ef72-5411-a9ee-f7f5baa70db1_= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Difference in shared_buffers (1GB) and effective_cache_size (default) only= . When I delete all data from the table, SELECT count(*) works.. -- Milo=C5=A1 Urb=C3=A1nek tel.: 736 608 345 ---------- P=C5=AFvodn=C3=AD e-mail ---------- Od: Pavel Stehule Komu: Milo=C5=A1 Urb=C3=A1nek Datum: 9. 5. 2022 10:22:16 P=C5=99edm=C4=9Bt: Re: BUG #17476: ERROR: "variable not found in subplan t= arget list" when running SELECT COUNT(*) " Hi po 9. 5. 2022 v=C2=A09:22 odes=C3=ADlatel Milo=C5=A1 Urb=C3=A1nek napsal: " I have 2 (ordinary) tables in 900+ table database restored from PG 9.6 (wi= th PostGIS geometries BTW) where this problem occurs. The count() queries into the other tables are OK. Also the problem happens only at the server but not at my Windows 10 workstation with the same PG 14.2. " Is there the same configuration on the server like on your workstation?= =C2=A0 The different configuration can enforce a different execution plan. Regards Pavel " No clue what could be wrong. PGAdmin4 fails even when trying to list SQL creation statement. -- Milos Urbanek ---------- P=C5=AFvodn=C3=AD e-mail ---------- Od: Tom Lane Komu: milos.urbanek@email.cz(mailto:milos.urbanek@email.cz) Datum: 9. 5. 2022 2:22:10 P=C5=99edm=C4=9Bt: Re: BUG #17476: ERROR: "variable not found in subplan t= arget list" when running SELECT COUNT(*) "PG Bug reporting form writes: > Trying to run simple SELECT COUNT(*) from some table gives me the following > error (either running by hand or trying to run EXPLAIN using pgadmin or = by > hand): > 2022-05-09 00:06:30.428 CEST [1196] ERROR: variable not found in subplan= > target list > 2022-05-09 00:06:30.428 CEST [1196] STATEMENT: SELECT COUNT(*) FROM > "domino_efekty_havarijniprojev" Is that really just a table? I could believe a bug like this for some types of views, but it's a bit hard to credit for a plain table. In any case, we can't do much with this report unless you can provide a reproducer case --- preferably a SQL script that creates an object that triggers the problem. regards, tom lane " " " --=_0953ed2c464e0acf1a513229=e8c3f721-ef72-5411-a9ee-f7f5baa70db1_= Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Difference in shared_buffers (1GB) and effective_cache_si= ze (default) only.

When I delete all data from th= e table, SELECT count(*) works..

--
Milo=C5=A1 Urb= =C3=A1nek
tel.: 736 608 345



Hi

po 9. 5. 2022 v 9:22 odes=C3=ADlatel Milo= =C5=A1 Urb=C3=A1nek <milos.ur= banek@email.cz> napsal:
I have 2 (ordinary) tables in 900+ table da= tabase restored from PG 9.6 (with PostGIS geometries BTW) where this probl= em occurs.
The count() queries into the other tables are OK.
Also the problem happens only at the server but not at my Windows 1= 0 workstation with the same PG 14.2.

=
Is there the same configuration on the server like on your work= station?  The different configuration can enforce a different executi= on plan.

Regards

Pavel


No clue what could be wrong.
=

PGAdmin4 fails even when trying to list SQL creation s= tatement.

--
Milos Urbanek

=0A= ---------- P=C5=AFvodn=C3=AD e-mail ----------
=0A= Od: Tom Lane <tgl@sss.pgh.pa.us>
=0A= Komu:
milos.urbanek@email.cz=
=0A= Datum: 9. 5. 2022 2:22:10
=0A= P=C5=99edm=C4=9Bt: Re: BUG #17476: ERROR: "variable not found in subplan t= arget list" when running SELECT COUNT(*)=0A=
PG Bug reporting form <noreply@postgresql.org> writes:=0A=
> Trying to run simple SELECT COUNT(*) from some table gives me the= following=0A=
> error (either running by hand or trying to run EXPLAIN using pgad= min or by=0A=
> hand):=0A=
=0A=
> 2022-05-09 00:06:30.428 CEST [1196] ERROR: variable not found in= subplan=0A=
> target list=0A=
> 2022-05-09 00:06:30.428 CEST [1196] STATEMENT: SELECT COUNT(*) F= ROM=0A=
> "domino_efekty_havarijniprojev"=0A=
=0A=
Is that really just a table? I could believe a bug like this for= =0A=
some types of views, but it's a bit hard to credit for a plain table.= =0A=
=0A=
In any case, we can't do much with this report unless you can provide= =0A=
a reproducer case --- preferably a SQL script that creates an object= =0A=
that triggers the problem.=0A=
=0A=
regards, tom lane=0A=
=0A=
--=_0953ed2c464e0acf1a513229=e8c3f721-ef72-5411-a9ee-f7f5baa70db1_=--