KaiGai Kohei wrote:
> Hi,
>
> The suppress_redundant_updates_trigger() works incorrectly
> on the table defined with "WITH_OIDS" option.
>
> ----------
> (*) The latest 8.4devel tree without SE-PostgreSQL patch
>
> postgres=# CREATE TABLE min_updates_test (
> f1 text,
> f2 int,
> f3 int) with oids;
> CREATE TABLE ^^^^^^^^^ <- Here is different from the regression test.
> postgres=# INSERT INTO min_updates_test VALUES ('a',1,2),('b','2',null);
> INSERT 0 2
> postgres=# CREATE TRIGGER z_min_update
> BEFORE UPDATE ON min_updates_test
> FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger();
> CREATE TRIGGER
> postgres=# UPDATE min_updates_test SET f1 = f1;
> UPDATE 2
> ----------
>
> The current version does not allow to update the "oid", so the older
> value is preserved implicitly. However, it is done at heap_update().
> Before-row-trigger functions are invoked before heap_update(), so
> the field to store the "oid" is empty (InvalidOid) at the moment.
> Then, suppress_redundant_updates_trigger() makes a decision there is
> a difference between old and new versions.
>
> It seems to me the older value has to be preserved just before
> invocation of row-trigger functions.
> Any comment?
>
>
>
Good catch!
I think ideally we'd just adjust the comparison to avoid the system
attributes.
I'll have a look to see if it can be done simply.
cheers
andrew