Re: Mutable foreign key constraints

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: 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:05:49
Message-ID: 7c9f8c8b-e5ca-4675-bc1c-f27789059ee7@proxel.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2024-09-13 13:38:03 Re: Mutable foreign key constraints
Previous Message Andreas Karlsson 2024-09-13 13:01:03 Re: Special-case executor expression steps for common combinations