pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Catalin Pitis <cpitis.pgsql@gmail.com>
To: pgsql-sql@postgresql.org
Subject: ERROR: plan should not reference subplan's variable
Date: Tue, 2 May 2006 22:13:53 +0300
Message-ID: <63c4c13c0605021213t4a3d5591m2a62dd3389009bb0@mail.gmail.com> (raw)

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

view thread (5+ messages)  latest in thread

Message-ID: <63c4c13c0605021213t4a3d5591m2a62dd3389009bb0@mail.gmail.com>
Permalink:  ../63c4c13c0605021213t4a3d5591m2a62dd3389009bb0@mail.gmail.com/
Also on:    postgresql.org/message-id/63c4c13c0605021213t4a3d5591m2a62dd3389009bb0@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: cpitis.pgsql@gmail.com
  Subject: Re: ERROR: plan should not reference subplan's variable
  In-Reply-To: <63c4c13c0605021213t4a3d5591m2a62dd3389009bb0@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox