Re: Minor buglet in update...from (I think)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Philip Warner <pjw(at)rhyme(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Minor buglet in update...from (I think)
Date: 2001-11-27 00:23:17
Message-ID: 200111270023.fAR0NHJ12366@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-11-27 00:28:31 Re: Minor buglet in update...from (I think)
Previous Message Tom Lane 2001-11-27 00:21:15 Re: Locale timings