Re: Mutable foreign key constraints - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Re: Mutable foreign key constraints
Date
Msg-id 7c9f8c8b-e5ca-4675-bc1c-f27789059ee7@proxel.se
Whole thread Raw
In response to Re: Mutable foreign key constraints  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Mutable foreign key constraints
List pgsql-hackers
On 9/13/24 4:41 AM, Laurenz Albe wrote:
> That's very broken and should not be allowed.

+1

>> A possible objection is that if anybody has such a setup and
>> hasn't noticed a problem because they never change their
>> timezone setting, they might not appreciate us breaking it.
> 
> I hope that there are few cases of that in the field, and I think it
> is OK to break them.  After all, it can be fixed with a simple
> 
>    ALTER TABLE foo ALTER id TYPE timestamptz;
> 
> If the session time zone is UTC, that wouldn't even require a rewrite.
> 
> I agree that it cannot be backpatched.

I unfortunately suspect there might be more cases than we think in the 
field due to many people not understanding the difference between 
timestamp and timestamptz but the good thing is that 
timestamp/timestamptz are rare in foreign keys, even in composite ones.

Since this is quite broken and does not have any real world usefulness I 
think we should just go ahead and disallow it and have a few people 
complain.

Andreas




pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: Special-case executor expression steps for common combinations
Next
From: Vik Fearing
Date:
Subject: Re: Mutable foreign key constraints