Re: cataloguing NOT NULL constraints

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: cataloguing NOT NULL constraints
Дата
Msg-id 202404251016.m2jyipj2zaav@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: cataloguing NOT NULL constraints  (Alexander Lakhin <exclusion@gmail.com>)
Ответы Re: cataloguing NOT NULL constraints
Список pgsql-hackers
On 2024-Apr-25, Alexander Lakhin wrote:

> While studying the NO INHERIT option, I've noticed that the documentation
> probably misses it's specification for NOT NULL:
> https://www.postgresql.org/docs/devel/sql-createtable.html
> 
> where column_constraint is:
> ...
> [ CONSTRAINT constraint_name ]
> { NOT NULL |
>   NULL |
>   CHECK ( expression ) [ NO INHERIT ] |

Hmm, okay, will fix.

> Also, I've found a weird behaviour with a non-inherited NOT NULL
> constraint for a partitioned table:
> CREATE TABLE pt(a int NOT NULL NO INHERIT) PARTITION BY LIST (a);
> CREATE TABLE dp(a int NOT NULL);
> ALTER TABLE pt ATTACH PARTITION dp DEFAULT;
> ALTER TABLE pt DETACH PARTITION dp;
> fails with:
> ERROR:  relation 16389 has non-inherited constraint "dp_a_not_null"

Ugh.  Maybe a way to handle this is to disallow NO INHERIT in
constraints on partitioned tables altogether.  I mean, they are a
completely useless gimmick, aren't they?

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: broken reading on standby (PostgreSQL 16.2)
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Race condition in FetchTableStates() breaks synchronization of subscription tables