ERROR: plan should not reference subplan's variable

From: "Catalin Pitis" <cpitis(dot)pgsql(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: ERROR: plan should not reference subplan's variable
Date: 2006-05-02 19:13:53
Message-ID: 63c4c13c0605021213t4a3d5591m2a62dd3389009bb0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi *

I'm trying to run the following SQL statement on a PostgreSQL 8.1, installed
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 = '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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-05-02 20:17:57 Re: ERROR: plan should not reference subplan's variable
Previous Message Peter Manchev 2006-05-02 18:54:55 Compute hash of a table?