From: | David C Mudie <mudie(at)digitaldeck(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | pgsql gives ExecutePlan error after empty UPDATE? |
Date: | 2000-07-10 22:15:26 |
Message-ID: | 200007102215.PAA89519@digitaldeck.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello! I am using PostgreSQL 7.0.2 on FreeBSD 3.4.
I am trying to update a table with the results of a
(possibly empty) selection:
zorro_4330=# create table foo(bar int4) \g
CREATE
zorro_4330=# update foo set bar = count(*) from foo \g
ERROR: ExecutePlan: (junk) `ctid' is NULL!
In this example, there are no rows in table "foo" to update.
Why is postgres returning this cryptic error instead of just UPDATE 0?
If I add a sample row, the same query works fine:
zorro_4330=# insert into foo values (1) \g
INSERT 50688 1
zorro_4330=# update foo set bar = count(*) from foo \g
UPDATE 1
If I change my query to update no rows, I get the error again:
zorro_4330=# update foo set bar = count(*) from foo where bar < 0 \g
ERROR: ExecutePlan: (junk) `ctid' is NULL!
Postgres seems to be reporting an error because the update matched no rows,
but this a perfectly legitimate database operation. I have not
been able to find any documentation on "ExecutePlan" or why it
thinks there is a problem.
Please let me know if you have any suggestions or workarounds for this problem,
or if there is somewhere more appropriate to discuss this. Thanks!
David
-----------------------------------------------------------------------------
David C Mudie DigitalDeck Inc mudie(at)digitaldeck(dot)com
San Mateo CA 94402 http://www.digitaldeck.com
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2000-07-10 22:24:20 | Re: Slashdot discussion |
Previous Message | Bruce Momjian | 2000-07-10 21:38:38 | Re: Re: [GENERAL] PostgreSQL vs. MySQL |