update with no changes

From: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: update with no changes
Date: 2021-11-19 16:38:25
Message-ID: CAB-JLwbvubZ17JEiHUrzyq=RvSYZ4cFeNtHkCM8ZDCCfuc328g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Why this happens ?

create table t(i int);
CREATE TABLE
insert into t values(1);
INSERT 0 1
select (ctid::text::point)[1]::int, * from t;
ctid | i
------+---
1 | 1
(1 row)
update t set i = i;
UPDATE 1
select (ctid::text::point)[1]::int, * from t;
ctid | i
------+---
2 | 1
(1 row)

If nothing was changed, why create a new record, append data to wal, set
old record as deleted, etc, etc ?

regards,
Marcos

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-11-19 16:38:47 Re: Shouldn't postgres_fdw report warning when it gives up getting result from foreign server?
Previous Message Bharath Rupireddy 2021-11-19 16:23:21 Re: A spot of redundant initialization of brin memtuple