Re: Mutable foreign key constraints

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Andreas Karlsson <andreas(at)proxel(dot)se>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Mutable foreign key constraints
Date: 2024-09-13 13:38:03
Message-ID: 15a193c9-e1e8-4ec3-a1b0-8179603bf859@postgresfriends.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9/13/24 15:05, Andreas Karlsson wrote:
> 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.

It will become a lot more common with WITHOUT OVERLAPS, so I think it is
important to fix this at the same time or earlier as that feature.

> 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.

+1
--
Vik Fearing

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2024-09-13 13:45:08 Re: per backend I/O statistics
Previous Message Andreas Karlsson 2024-09-13 13:05:49 Re: Mutable foreign key constraints