X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id BD35C9FA25D for ; Tue, 2 May 2006 16:14:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 21676-05 for ; Tue, 2 May 2006 16:13:54 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.236]) by postgresql.org (Postfix) with ESMTP id 9B6349F9CC1 for ; Tue, 2 May 2006 16:13:54 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i22so934315wra for ; Tue, 02 May 2006 12:13:53 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=mG7fvq44rMxNwRrtKaBr7pEM1rK9Gsx6KoDuICgTlzRBMk+UtCkroUiLKyu+m7UzK8SktsPSNDUh/WB/ev5mGq+QtDjV+n/cMv2QYtH4iNlTusjiMMWvb3yEbGSzoP5PBTWx1r67S4U+ys9xAkGfHxO5d+CkrbIW0xv0GYFIAsg= Received: by 10.54.124.3 with SMTP id w3mr995257wrc; Tue, 02 May 2006 12:13:53 -0700 (PDT) Received: by 10.54.135.14 with HTTP; Tue, 2 May 2006 12:13:53 -0700 (PDT) Message-ID: <63c4c13c0605021213t4a3d5591m2a62dd3389009bb0@mail.gmail.com> Date: Tue, 2 May 2006 22:13:53 +0300 From: "Catalin Pitis" To: pgsql-sql@postgresql.org Subject: ERROR: plan should not reference subplan's variable MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10986_33016288.1146597233528" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/14 X-Sequence-Number: 25045 ------=_Part_10986_33016288.1146597233528 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi * I'm trying to run the following SQL statement on a PostgreSQL 8.1, installe= d on a Windows machine: INSERT INTO PROJECT(PROJECT_ID,PROJECT_DESC) ( SELECT MAX(PROJECT_ID),'MYPROJECT' FROM PROJECT WHERE NOT EXISTS ( SELECT PROJECT_DESC FROM PROJECT WHERE PROJECT_DESC =3D 'MYPROJECT' ) ) and I get the following error: ERROR: plan should not reference subplan's variable If, for example, I replace MAX with some other aggregation (e.g. AVG or SUM), everything works ok. The table DDL looks like: CREATE TABLE project ( project_id int4 NOT NULL, project_desc varchar(255), CONSTRAINT project_pkey PRIMARY KEY (project_id) ) WITH OIDS; Do you have any clue why does this happen? Thanks, Catalin ------=_Part_10986_33016288.1146597233528 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hi *
 
I'm trying to run the following SQL statement on a PostgreSQL 8.1, ins= talled on a Windows machine:
 
INSERT INTO PROJECT(PROJECT_ID,PROJECT_DESC)
(
SELECT MAX(PROJE= CT_ID),'MYPROJECT'
FROM PROJECT
WHERE NOT EXISTS
 (
&nbs= p; SELECT PROJECT_DESC FROM PROJECT WHERE PROJECT_DESC =3D 'MYPROJECT'=
 )
)
 
and I get the following error:
 
ERROR:  plan should not reference subplan's variable
 
If, for example, I replace MAX with some other aggregation (e.g. AVG o= r SUM), everything works ok.
 
The table DDL looks like:
 
CREATE TABLE project
(
  project_id int4 NOT NULL,
 = ; project_desc varchar(255),
  CONSTRAINT project_pkey PRIMARY KEY = (project_id)
)
WITH OIDS;
 
 
Do you have any clue why does this happen?
 
Thanks,
Catalin
------=_Part_10986_33016288.1146597233528--