Re: cataloguing NOT NULL constraints - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: cataloguing NOT NULL constraints
Date
Msg-id 20220920105109.kopdp7wmlkfi5ci5@alvherre.pgsql
Whole thread Raw
In response to Re: cataloguing NOT NULL constraints  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 2022-Sep-19, Robert Haas wrote:

> On Wed, Aug 17, 2022 at 2:12 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

> > 55489 16devel 1776237=# \d tab
> >                     Tabla «public.tab»
> >  Columna │  Tipo   │ Ordenamiento │ Nulable  │ Por omisión
> > ─────────┼─────────┼──────────────┼──────────┼─────────────
> >  a       │ integer │              │ not null │
> > Restricciones CHECK:
> >     "tab_a_not_null" CHECK (a IS NOT NULL)
> 
> In a table with many columns, most of which are NOT NULL, this is
> going to produce a ton of clutter. I don't like that.
> 
> I'm not sure what a good alternative would be, though.

Perhaps that can be solved by displaying the constraint name in the
table:

 55489 16devel 1776237=# \d tab
                     Tabla «public.tab»
  Columna │  Tipo   │ Ordenamiento │     Nulable    │ Por omisión
 ─────────┼─────────┼──────────────┼────────────────┼─────────────
  a       │ integer │              │ tab_a_not_null │ 

(Perhaps we can change the column title also, not sure.)

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"The Gord often wonders why people threaten never to come back after they've
been told never to return" (www.actsofgord.com)



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_create_logical_replication_slot argument incongruency
Next
From: Alvaro Herrera
Date:
Subject: Re: cataloguing NOT NULL constraints