Re: inconsistent behavior with "GENERATED BY DEFAULT AS IDENTITY"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: inconsistent behavior with "GENERATED BY DEFAULT AS IDENTITY"
Дата
Msg-id 1124414.1630244418@sss.pgh.pa.us
обсуждение исходный текст
Ответ на inconsistent behavior with "GENERATED BY DEFAULT AS IDENTITY"  (Himanshu Upadhyaya <upadhyaya.himanshu@gmail.com>)
Ответы Re: inconsistent behavior with "GENERATED BY DEFAULT AS IDENTITY"
Список pgsql-hackers
Himanshu Upadhyaya <upadhyaya.himanshu@gmail.com> writes:
> IMHO below query should replace "NULL" value for ID column with the
> GENERATED IDENTITY value (should insert 1,10 for ID and ID1 respectively in
> below's example), similar to what we expect when we have DEFAULT constraint
> on the column.

Why?  Ordinary DEFAULT clauses do not act that way; if you specify NULL
(or any other value) that is what you get.  If you want the default
value, you can omit the column, or write DEFAULT.

> Any reason for disallowing NULL insertion?

Consistency and standards compliance.

            regards, tom lane



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

Предыдущее
От: Himanshu Upadhyaya
Дата:
Сообщение: inconsistent behavior with "GENERATED BY DEFAULT AS IDENTITY"
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Spelling change in LLVM 14 API