Re: Is this a buggy behavior?

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: Is this a buggy behavior?
Дата
Msg-id 1a07537f-f450-4a9c-83d8-364edd712706@a-kretschmer.de
обсуждение исходный текст
Ответ на Re: Is this a buggy behavior?  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
Ответы Re: Is this a buggy behavior?
Список 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




В списке pgsql-general по дате отправления:

Предыдущее
От: Thiemo Kellner
Дата:
Сообщение: Re: Is this a buggy behavior?
Следующее
От: Erik Wienhold
Дата:
Сообщение: Re: Is this a buggy behavior?