ERROR: variable not found in subplan target lists - Mailing list pgsql-general

From Miroslav Šulc
Subject ERROR: variable not found in subplan target lists
Date
Msg-id 4704D5E7.9020500@startnet.cz
Whole thread Raw
Responses Re: ERROR: variable not found in subplan target lists  (Miroslav Šulc <miroslav.sulc@startnet.cz>)
List pgsql-general
Hi,

I get this error when running this query (generated by code so it is not
ideal though still valid I guess):

SELECT Invoice.* FROM Invoice WHERE false AND InvoiceGroupId IN (SELECT
InvoiceGroup.Id FROM InvoiceGroup INNER JOIN PartnerBranch ON
InvoiceGroup.PartnerBranchId = PartnerBranch.Id  WHERE
PartnerBranch.PartnerIdentificationId IN (132));

Running these modified queries works without problems:

SELECT Invoice.* FROM Invoice WHERE InvoiceGroupId IN (SELECT
InvoiceGroup.Id FROM InvoiceGroup INNER JOIN PartnerBranch ON
InvoiceGroup.PartnerBranchId = PartnerBranch.Id  WHERE
PartnerBranch.PartnerIdentificationId IN (132));

SELECT Invoice.* FROM Invoice WHERE false AND InvoiceGroupId IN (SELECT
InvoiceGroup.Id FROM InvoiceGroup INNER JOIN PartnerBranch ON
InvoiceGroup.PartnerBranchId = PartnerBranch.Id);

SELECT Invoice.* FROM Invoice WHERE false AND InvoiceGroupId IN (SELECT
InvoiceGroup.Id FROM InvoiceGroup INNER JOIN PartnerBranch ON
InvoiceGroup.PartnerBranchId = PartnerBranch.Id  WHERE PartnerBranch.Id
IN (132));

The weird thing is it occurs only on production server, not on any other
of pg installations. All of them are pg 8.2.4 on Gentoo Linux.

I'd appreciate any help as the problem occurs on production server and I
need to solve it ASAP.

--
Miroslav Šulc


pgsql-general by date:

Previous
From: Florian Pflug
Date:
Subject: Re: Generating TRUNCATE orders
Next
From: Miroslav Šulc
Date:
Subject: Re: ERROR: variable not found in subplan target lists