Re: cataloguing NOT NULL constraints

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: cataloguing NOT NULL constraints
Date: 2023-08-09 11:10:29
Message-ID: 20230809111029.dlztbsuu5yyapi7x@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-Aug-09, Peter Eisentraut wrote:

> I wonder whether the root of these problems is that we mix together primary
> key constraints and not-null constraints. I understand that right now, with
> the proposed patch, when a table inherits from a parent table with a primary
> key constraint, we generate not-null constraints on the child, in order to
> enforce the not-nullness. What if we did something like this instead: In
> the child table, we don't generate a not-null constraint, but instead a
> primary key constraint entry. But we mark the primary key constraint
> somehow to say, this is just for the purpose of inheritance, don't enforce
> uniqueness, but enforce not-nullness. Would that work?

Hmm. One table can have many parents, and many of them can have primary
keys. If we tried to model it the way you suggest, the child table
would need to have several primary keys. I don't think this would work.

But I think I just need to stare at the dependency graph a little while
longer. Maybe I just need to add some extra edges to make it work
correctly.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiro Ikeda 2023-08-09 11:10:42 Re: Support to define custom wait events for extensions
Previous Message Christoph Berg 2023-08-09 10:56:06 Re: A failure in 031_recovery_conflict.pl on Debian/s390x