Re: Minor buglet in update...from (I think) - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Minor buglet in update...from (I think)
Date
Msg-id 200111270023.fAR0NHJ12366@candle.pha.pa.us
Whole thread Raw
In response to Re: Minor buglet in update...from (I think)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Minor buglet in update...from (I think)
List pgsql-hackers
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Can anyone explain this failure?  It still exists in CVS.
> 
> >> update t1 set f2=count(*) from t2 where t1.f1=2 and t2.f1=t1.f1 ;
> >> ERROR:  ExecutePlan: (junk) `ctid' is NULL!
> 
> As I recall, discussion about fixing that problem trailed off because
> no one could explain what an aggregate means in UPDATE.  My thought
> is we should probably forbid the construct entirely (SQL does).
> See previous discussion around 7/7/00.

Oh, so it is the aggregate.  What threw me off is that both parts of the
WHERE clause are required to cause the failure, so I thought it was
something else.

I don't see a problem with aggregates in UPDATE, except when the updated
field is part of the WHERE clause, but even then, transaction semantics
should make it matter.  I see the mailist thread now.

I will try and get it added to the TODO list so it is documented.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Locale timings
Next
From: Tom Lane
Date:
Subject: Re: Minor buglet in update...from (I think)