Re: Fix optimization of foreign-key on update actions - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Fix optimization of foreign-key on update actions
Date
Msg-id c919566d-17ad-7a93-b3f2-7b64afc1297a@2ndquadrant.com
Whole thread Raw
In response to Re: Fix optimization of foreign-key on update actions  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
On 06/02/2019 12:23, Andrew Gierth wrote:
> Two values which are sql-equal but not identical, such as two strings in
> a case-insensitive collation that differ only by case, are
> distinguishable in some contexts but not others, so what context
> actually applies to the quoted rule?
> 
> I think the only reasonable interpretation is that it should use the
> same kind of distinctness that is being used by the unique constraint
> and the equality comparison that define whether the FK is satisfied.

By that logic, a command such as

    UPDATE t1 SET x = '0' WHERE x = '-0';

could be optimized away as a noop, because in that world there is no
construct by which you can prove whether the update happened.

I think that would not be satisfactory.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Next
From: Peter Eisentraut
Date:
Subject: Re: Fix optimization of foreign-key on update actions