pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyle Bateman <kyle@actarg.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: unplanned sub-select error?
Date: Tue, 22 Nov 2005 13:24:59 -0700
Message-ID: <43837E9B.20306@actarg.com> (raw)
In-Reply-To: <6603.1132621854@sss.pgh.pa.us>
References: <43826850.1020302@actarg.com>
	<6603.1132621854@sss.pgh.pa.us>

Tom Lane wrote:

>Kyle Bateman <kyle@actarg.com> writes:
>  
>
>>I have a query:
>>insert into mtr_reg_v_wt (ropnum, inum, pnum, rquant, value, status, 
>>ddate, fr_proj, to_proj) values (28985,1,1014,1,(select cost from 
>>prd_part where pnum = 1014),'work','2005-Nov-15',50,75);
>>    
>>
>
>  
>
>>That used to work fine under 7.1.3 but now gives the error:
>>    
>>
>
>  
>
>>ERROR:  cannot handle unplanned sub-select
>>    
>>
>
>You need to offer a little more context, like what PG version you are
>using now and what is the underlying DDL --- I suspect some rules or
>views are involved here, but you didn't show them to us.
>
>  
>
Sorry, you're right.  I have now confirmed that this only happens when 
updating via a view/rule (as you suspected).  Attached is a minimalist 
sql file that demonstrates the same error message from a blank 
database.  I'm using 8.1.0.  I'm pretty sure this problem did not exist 
on 8.0.3.

Kyle

Attachments:

testmtr.sql (text/x-sql, 744B) download -- Expose the "unplanned sub-select" error message create table parts ( partnum varchar(18) primary key, cost float8 ); create table shipped ( ttype char(2), ordnum int4, partnum varchar(18) references parts, value float8, primary key (ttype, ordnum) ); create view shipped_view as select * from shipped where ttype = 'wt'; create rule shipped_view_insert as on insert to shipped_view do instead insert into shipped (ttype, ordnum, partnum, value) values ('wt', new.ordnum, new.partnum, new.value); insert into parts (partnum, cost) values (1, 1234.56); insert into shipped_view (ordnum, partnum, value) values (100,1,(select cost from parts where partnum = 1));

view thread (5+ messages)  latest in thread

Message-ID: <43837E9B.20306@actarg.com>
Permalink:  ../43837E9B.20306@actarg.com/
Also on:    postgresql.org/message-id/43837E9B.20306@actarg.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: kyle@actarg.com, tgl@sss.pgh.pa.us
  Subject: Re: unplanned sub-select error?
  In-Reply-To: <43837E9B.20306@actarg.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