Re: Mutable foreign key constraints

2024-09-14 Thread Tom Lane
Andrew Dunstan writes: > On 2024-09-12 Th 5:33 PM, Tom Lane wrote: >> I'm inclined to propose rejecting FK constraints if the comparison >> operator is not immutable. > Isn't there an upgrade hazard here? People won't thank us if they can't > now upgrade their clusters. If we can get around that

Re: Mutable foreign key constraints

2024-09-14 Thread Andrew Dunstan
On 2024-09-12 Th 5:33 PM, Tom Lane wrote: I happened to notice that Postgres will let you do regression=# create table foo (id timestamp primary key); CREATE TABLE regression=# create table bar (ts timestamptz references foo); CREATE TABLE This strikes me as a pretty bad idea, because whether

Re: Mutable foreign key constraints

2024-09-13 Thread Vik Fearing
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

Re: Mutable foreign key constraints

2024-09-13 Thread Andreas Karlsson
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 fe

Re: Mutable foreign key constraints

2024-09-12 Thread Laurenz Albe
On Thu, 2024-09-12 at 17:33 -0400, Tom Lane wrote: > I happened to notice that Postgres will let you do > > regression=# create table foo (id timestamp primary key); > CREATE TABLE > regression=# create table bar (ts timestamptz references foo); > CREATE TABLE > > This strikes me as a pretty bad

Re: Mutable foreign key constraints

2024-09-12 Thread Tom Lane
"David G. Johnston" writes: > On Thursday, September 12, 2024, Tom Lane wrote: >> 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. >> So I certainly wouldn't prop

Re: Mutable foreign key constraints

2024-09-12 Thread David G. Johnston
On Thursday, September 12, 2024, Tom Lane wrote: > > 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. > So I certainly wouldn't propose back-patching this. But > m