From: | Andreas Kretschmer <andreas(at)a-kretschmer(dot)de> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Is this a buggy behavior? |
Date: | 2024-03-24 15:44:41 |
Message-ID: | 1a07537f-f450-4a9c-83d8-364edd712706@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Am 24.03.24 um 16:41 schrieb Thiemo Kellner:
>
>
> Am 24.03.2024 um 16:36 schrieb Andreas Kretschmer:
>> the null-able constraint addition to a column is pointless because by
>> default all columns are nullable. definition as a primary key adds
>> the not null constraint.
>
> While this is certainly true, I do not see why the information that a
> not null constraint is to be created or has been created is not
> available.
>
>
postgres=# create table bla(i int null primary key);
CREATE TABLE
postgres=# \d bla
Table "public.bla"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
i | integer | | not null |
Indexes:
"bla_pkey" PRIMARY KEY, btree (i)
postgres=# drop table bla;
DROP TABLE
postgres=# create table bla(i int not null primary key);
CREATE TABLE
postgres=# \d bla
Table "public.bla"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
i | integer | | not null |
Indexes:
"bla_pkey" PRIMARY KEY, btree (i)
postgres=#
as you can see, there is no difference. the PK-Constraint is the
important thing here.
Andreas
--
Andreas Kretschmer
CYBERTEC PostgreSQL Services and Support
From | Date | Subject | |
---|---|---|---|
Next Message | Erik Wienhold | 2024-03-24 15:59:29 | Re: Is this a buggy behavior? |
Previous Message | Thiemo Kellner | 2024-03-24 15:42:49 | Re: Is this a buggy behavior? |