If a column type is being changed with USING (NULL) clause,
NOT NULL constraint seems not to be checked:

[EMAIL PROTECTED] CREATE table test (x integer not null);
CREATE TABLE
[EMAIL PROTECTED] INSERT INTO test VALUES (1);
INSERT 0 1
[EMAIL PROTECTED] ALTER TABLE test ALTER x TYPE boolean USING (NULL);
ALTER TABLE
[EMAIL PROTECTED] \d test
     Table "public.test"
 Column |  Type   | Modifiers
--------+---------+-----------
 x      | boolean | not null

[EMAIL PROTECTED] SELECT * from test;
 x
---

(1 row)

[EMAIL PROTECTED] 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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to