Re: cataloguing NOT NULL constraints
| От | Alvaro Herrera |
|---|---|
| Тема | Re: cataloguing NOT NULL constraints |
| Дата | |
| Msg-id | 202404241736.jf2zq2qmrgov@alvherre.pgsql обсуждение |
| Ответ на | Re: cataloguing NOT NULL constraints (Alvaro Herrera <alvherre@alvh.no-ip.org>) |
| Ответы |
Re: cataloguing NOT NULL constraints
|
| Список | pgsql-hackers |
On 2024-Apr-22, Alvaro Herrera wrote: > > On d9f686a72~1 this script results in: > > ERROR: cannot change NO INHERIT status of inherited NOT NULL constraint "t_a_not_null" on relation "t" > > Right. Now I'm beginning to wonder if allowing ADD CONSTRAINT to mutate > a pre-existing NO INHERIT constraint into a inheritable constraint > (while accepting a constraint name in the command that we don't heed) is > really what we want. Maybe we should throw some error when the affected > constraint is the topmost one, and only accept the inheritance status > change when we're recursing. So I added a restriction that we only accept such a change when recursively adding a constraint, or during binary upgrade. This should limit the damage: you're no longer able to change an existing constraint from NO INHERIT to YES INHERIT merely by doing another ALTER TABLE ADD CONSTRAINT. One thing that has me a little nervous about this whole business is whether we're set up to error out where some child table down the hierarchy has nulls, and we add a not-null constraint to it but fail to do a verification scan. I tried a couple of cases and AFAICS it works correctly, but maybe there are other cases I haven't thought about where it doesn't. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "You're _really_ hosed if the person doing the hiring doesn't understand relational systems: you end up with a whole raft of programmers, none of whom has had a Date with the clue stick." (Andrew Sullivan) https://postgr.es/m/20050809113420.GD2768@phlogiston.dyndns.org
Вложения
В списке pgsql-hackers по дате отправления: