Lists: | pgsql-bugs |
---|
From: | "Alexander M(dot) Pravking" <fduch(at)antar(dot)bryansk(dot)ru> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | ALTER TYPE ... USING(NULL) / NOT NULL violation |
Date: | 2006-07-04 11:03:02 |
Message-ID: | 20060704110302.GB87356@dyatel.antar.bryansk.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
If a column type is being changed with USING (NULL) clause,
NOT NULL constraint seems not to be checked:
fduch(at)~=# CREATE table test (x integer not null);
CREATE TABLE
fduch(at)~=# INSERT INTO test VALUES (1);
INSERT 0 1
fduch(at)~=# ALTER TABLE test ALTER x TYPE boolean USING (NULL);
ALTER TABLE
fduch(at)~=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------
x | boolean | not null
fduch(at)~=# SELECT * from test;
x
---
(1 row)
fduch(at)~=# SELECT version();
version
------------------------------------------------------------------------------------------------
PostgreSQL 8.1.4 on i386-portbld-freebsd6.1, compiled by GCC cc (GCC) 3.4.4 [FreeBSD] 20050518
(1 row)
8.0 branch has the same behavour.
--
Fduch M. Pravking
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Alexander M(dot) Pravking" <fduch(at)antar(dot)bryansk(dot)ru> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: ALTER TYPE ... USING(NULL) / NOT NULL violation |
Date: | 2006-07-04 14:05:26 |
Message-ID: | 20370.1152021926@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
"Alexander M. Pravking" <fduch(at)antar(dot)bryansk(dot)ru> writes:
> If a column type is being changed with USING (NULL) clause,
> NOT NULL constraint seems not to be checked:
Hm, the code seems to have provisions to check "SET NOT NULL", but
it fails to check pre-existing NOT NULL attributes :-(
regards, tom lane
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Alexander M(dot) Pravking" <fduch(at)antar(dot)bryansk(dot)ru> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: ALTER TYPE ... USING(NULL) / NOT NULL violation |
Date: | 2006-07-10 22:12:55 |
Message-ID: | 3468.1152569575@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
"Alexander M. Pravking" <fduch(at)antar(dot)bryansk(dot)ru> writes:
> If a column type is being changed with USING (NULL) clause,
> NOT NULL constraint seems not to be checked:
I've committed patches for this. Thanks for the report.
regards, tom lane