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 1noCmu-0005m0-2B for pgsql-bugs@arkaria.postgresql.org; Mon, 09 May 2022 23:27:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1noClt-0003sd-6g for pgsql-bugs@arkaria.postgresql.org; Mon, 09 May 2022 23:26:33 +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 1noCls-0003s5-L8 for pgsql-bugs@lists.postgresql.org; Mon, 09 May 2022 23:26:32 +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 1noClp-0005Bm-Bq for pgsql-bugs@lists.postgresql.org; Mon, 09 May 2022 23:26:31 +0000 Received: from email.seznam.cz by email-smtpc5a.ng.seznam.cz (email-smtpc5a.ng.seznam.cz [10.23.10.135]) id 05e9e7113dca012d0500eb74; Tue, 10 May 2022 01:26:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=email.cz; s=beta; t=1652138784; bh=iw+tkX4AczE4n2hjpFsHz3+CyTjryja8fFm26prFQPM=; h=Received:From:To:Cc:Subject:Date:Message-Id:References: Mime-Version:X-Mailer:Content-Type:X-szn-frgn:X-szn-frgc; b=AoxiZhEjJilk68hs3P7jwFwyAevOnIm17bQqC3WcNEqbYAAq5bIImLWvkeq9Y1y2m U7NAZPfDGD3GFcin61gYFrbnv8NMvzLWqAyqI3hsW3rn7rxkmlBINpVLVn4+HKb3YV bbE2mFacgZV+2JTLOYHHIC9cl7IeoJPZrriBBBG0= 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.108) with HTTP; Tue, 10 May 2022 01:26:18 +0200 (CEST) From: =?utf-8?q?Milo=C5=A1_Urb=C3=A1nek?= To: "Tom Lane" Cc: 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: Tue, 10 May 2022 01:26:17 +0200 (CEST) Message-Id: References: <17476-cf579fc6b204baa2@postgresql.org> <3488097.1652055721@sss.pgh.pa.us> Mime-Version: 1.0 (szn-mime-2.1.20) X-Mailer: szn-ebox-5.0.108 Content-Type: multipart/alternative; boundary="=_7d90abae2484a6be2ee4522d=e8c3f721-ef72-5411-a9ee-f7f5baa70db1_=" X-szn-frgn: X-szn-frgc: <0> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=_7d90abae2484a6be2ee4522d=e8c3f721-ef72-5411-a9ee-f7f5baa70db1_= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, the simplest script is something like: create extension if not exists postgis; CREATE TABLE IF NOT EXISTS public.table_with_geom ( =C2=A0=C2=A0=C2=A0 id integer NOT NULL, =C2=A0=C2=A0=C2=A0 geom geometry(Point,5514) ); CREATE INDEX IF NOT EXISTS table_with_geom_id ON table_with_geom USING gis= t (geom); SET enable_seqscan =3D OFF; SET enable_bitmapscan =3D OFF; explain select count(*) from table_with_geom; This should print: NOTICE: extension "postgis" already exists, skipping ERROR: variable not = found in subplan target list SQL state: XX000 Regards -- Milosh ---------- P=C5=AFvodn=C3=AD e-mail ---------- Od: Tom Lane Komu: 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 " --=_7d90abae2484a6be2ee4522d=e8c3f721-ef72-5411-a9ee-f7f5baa70db1_= Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi,

the simplest script is somet= hing like:

create extension if not exists postgis= ;
CREATE TABLE IF NOT EXISTS public.table_with_geom
(
  = ;  id integer NOT NULL,
    geom geometry(Point,551= 4)
);
CREATE INDEX IF NOT EXISTS table_with_geom_id ON table_with_ge= om USING gist (geom);
SET enable_seqscan =3D OFF;
SET enable_bitmaps= can =3D OFF;
explain select count(*) from table_with_geom;
This should print:

NOTICE: extension "postgis" already exists, skipping=0A= =0A= ERROR: variable not found in subplan target list=0A= SQL state: XX000

Regards

--
Milosh


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=
--=_7d90abae2484a6be2ee4522d=e8c3f721-ef72-5411-a9ee-f7f5baa70db1_=--