The following bug has been logged online:
Bug reference: 5053
Logged by: Andrew Gierth
Email address: andrew@tao11.riddles.org.uk
PostgreSQL version: 8.5devel
Operating system: FreeBSD
Description: domain constraints still leak
Details:
Domain NOT NULL constraints (and probably other constraints too) aren't
being enforced in some code paths. e.g.
\pset null '<NULL>'
create domain tstdom as integer not null;
create table test (a tstdom);
insert into test values (null);
ERROR: domain tstdom does not allow null values
all correct up to now, but:
insert into test select (r).* from (select null::test as r) s;
INSERT 0 1
oops.
select * from test;
a
--------
<NULL>
(1 row)