On enforcing default column value, AKA "Bloody nulls"

From: Wiwwo Staff <wiwwo(at)wiwwo(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: On enforcing default column value, AKA "Bloody nulls"
Date: 2025-01-16 12:14:54
Message-ID: CAD1W9HW=PZMZMN7GmPWVUW8BSnvzCYJn=W8nmRXqTaUntSaTdg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all!
In a scenario like this:

> =# create table tab1(text1 text default 'from table');
>
> =# create procedure ins_tab1(p_text1 text default 'from proc') language
sql as
> -# $$
> $# insert into tab1(text1) values (p_text1);
> $# $$;
>
> =# call ins_tab1 (null);
>
> =# select * from tab1 ;
> text1
> --------
> [nUlL]

Is there a way (apart from triggers) to force at least one of the default
values?

Thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2025-01-16 12:24:22 Re: On enforcing default column value, AKA "Bloody nulls"
Previous Message Tim Gerber 2025-01-15 21:14:49 Re: Data Out of Sync with Physical Streaming Replication