Re: ERROR: variable not found in subplan target lists

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Miroslav S(ulc <miroslav(dot)sulc(at)startnet(dot)cz>, PGSQL mailing list <pgsql-general(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: ERROR: variable not found in subplan target lists
Date: 2007-10-04 17:26:50
Message-ID: 4705225A.5060605@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom Lane wrote:
> =?ISO-8859-2?Q?Miroslav_=A9ulc?= <miroslav(dot)sulc(at)startnet(dot)cz> writes:
>> Here is the complete dump and the query. In my case the bug is
>> reproducible using it.

> In a perfect world we'd not have this problem because
> const-simplification would have got rid of the IN altogether, and we'd
> have a plan equivalent to "SELECT Invoice.* FROM Invoice WHERE false".
> However making that happen seems quite difficult/risky because of
> order-of-operations issues --- we really want to do jointree
> rearrangement before we do expression simplification. Since it's
> such a hokey query (how many applications really write "WHERE false"?),

Three letters :)... O.R.M

I see this type of weirdness all the time... The most recent was
something like this:

AND ((lower(a.firstName) LIKE NULL OR NULL IS NULL)
AND (lower(a.middleName) LIKE NULL OR NULL IS NULL)
AND (lower(a.lastName) LIKE '%foo%' OR '%foo%' IS NULL)
AND (lower(b.emailAddress) LIKE NULL OR NULL IS NULL) )

Granted this isn't WHERE FALSE, but I certainly see WHERE TRUE all the
time in similar scenarios and I have seen WHERE FALSE.

Sincerely,

Joshua D. Drake

Joshua D. Drake

- --

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997 http://www.commandprompt.com/
UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHBSJaATb/zqfZUUQRAnPFAJ9Ut8H9MrC22xBqL4FXqNe9WpMefACdHdc8
To8QKvTQcgoicOSfAzhGYC0=
=qnfG
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-10-04 17:33:09 Re: ERROR: variable not found in subplan target lists
Previous Message Geoffrey 2007-10-04 17:24:35 Re: good sql tutorial