BUG #5477: CREATE DOMAIN NOT NULL constraints not always enforced for INSERT with subquery

Поиск
Список
Период
Сортировка
От Matt Nourse
Тема BUG #5477: CREATE DOMAIN NOT NULL constraints not always enforced for INSERT with subquery
Дата
Msg-id 201005280253.o4S2rBR3022404@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5477: CREATE DOMAIN NOT NULL constraints not always enforced for INSERT with subquery  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5477
Logged by:          Matt Nourse
Email address:      matthew@nplus1.com.au
PostgreSQL version: 8.4
Operating system:   Linux (Debian and Red Hat)
Description:        CREATE DOMAIN NOT NULL constraints not always enforced
for INSERT with subquery
Details:

Set up:

CREATE DOMAIN test_id_domain INT NOT NULL;

CREATE TABLE test_state(id test_id_domain PRIMARY KEY, display_value
varchar(20) NOT NULL);

CREATE TABLE test_city(state_id test_id_domain REFERENCES test_state(id));


This produces an error as expected:

INSERT INTO test_city(state_id) VALUES (NULL);


This successfully inserts a NULL value into the state_id field:

INSERT INTO test_city(state_id) VALUES ((SELECT id FROM test_state WHERE
display_value = 'Nonexistent state'));


When I use simpler subqueries (eg SELECT 1 WHERE 1 = 0), the NOT NULL
constraint is enforced.

If I remove the test_id_domain domain and replace its use with INT NOT NULL,
the constraint is enforced.

Thanks and regards,
Matt

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

Предыдущее
От: Krzysztof Nienartowicz
Дата:
Сообщение: Re: Query causing explosion of temp space with join involving partitioning
Следующее
От: "Markus"
Дата:
Сообщение: BUG #5478: ILIKE operator returns wrong result