Re: BUG #13875: Error explaining query - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #13875: Error explaining query
Date
Msg-id CAKFQuwYLjrt3G2Hgp0z-RRP_C8Km8XCA2H_rTeTEOcP_bRR7EA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #13875: Error explaining query  ("Smith, Travis" <Travis.Smith@IRIWorldwide.com>)
Responses Re: BUG #13875: Error explaining query
Re: BUG #13875: Error explaining query
List pgsql-bugs
On Tue, Jan 19, 2016 at 7:22 AM, Smith, Travis <
Travis.Smith@iriworldwide.com> wrote:

> HI Tom,
>
> Sounds good.    I would like to help with the self-contained case.    Wha=
t
> do you need from me?
>
>
>
> Thank you,
> Travis
>
>
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Monday, January 18, 2016 10:18 PM
> To: Smith, Travis
> Cc: pgsql-bugs@postgresql.org
> Subject: Re: [BUGS] BUG #13875: Error explaining query
>
> travis.smith@iriworldwide.com writes:
> > =3D# explain select count(1) from (SELECT DISTINCT
> > "IRI_IT_M_2782_7472_O"."ATTR_VALUE",
> > "IRI_IT_M_2782_7472_O"."SORT_ORDER",
> > "IT_DIM_IRI_7472"."M_2796_KEY", "IT_DIM_IRI_7472"."M_2782_KEY" FROM
> > "IT_DIM_IRI_7472", "IRI_IT_M_2782_7472_O" WHERE
> > ("IT_DIM_IRI_7472"."S_848_KEY" =3D 4527492) AND
> > ("IT_DIM_IRI_7472"."M_2782_KEY" =3D "IRI_IT_M_2782_7472_O"."AVP_KEY")
> > ORDER BY "IT_DIM_IRI_7472"."M_2796_KEY" ASC,
> > "IRI_IT_M_2782_7472_O"."SORT_ORDER" ASC,
> > "IT_DIM_IRI_7472"."M_2782_KEY" ASC  ) t;
>
> > ERROR:  variable not found in subplan target list
>
> What I get is
>
> ERROR:  relation "IT_DIM_IRI_7472" does not exist LINE 4:
> "IT_DIM_IRI_7472", "IRI_IT_M_2782_7472_O" WHERE
>         ^
>

=E2=80=8BIdeally, something like:

WITH data_cte AS (
=E2=80=8BVALUES (), (), (), ...=E2=80=8B
)=E2=80=8B
SELECT *
FROM data_cte

Where the main select causes the relevant error.

Otherwise a "psql" script file with the various and sundry CREATE TABLE,
CREATE INDEX, INSERT, SELECT statements that, when fed into "psql", cause
the error.

David J.

pgsql-bugs by date:

Previous
From: "Smith, Travis"
Date:
Subject: Re: BUG #13875: Error explaining query
Next
From: "Smith, Travis"
Date:
Subject: Re: BUG #13875: Error explaining query