Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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                        |
  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


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group