dbTalk Databases Forums  

[BUGS] ALTER TYPE ... USING(NULL) / NOT NULL violation

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] ALTER TYPE ... USING(NULL) / NOT NULL violation in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default [BUGS] ALTER TYPE ... USING(NULL) / NOT NULL violation - 07-04-2006 , 06:31 AM






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

fduch@~=# CREATE table test (x integer not null);
CREATE TABLE
fduch@~=# INSERT INTO test VALUES (1);
INSERT 0 1
fduch@~=# ALTER TABLE test ALTER x TYPE boolean USING (NULL);
ALTER TABLE
fduch@~=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------
x | boolean | not null

fduch@~=# SELECT * from test;
x
---

(1 row)

fduch@~=# 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 With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] ALTER TYPE ... USING(NULL) / NOT NULL violation - 07-04-2006 , 09:08 AM






"Alexander M. Pravking" <fduch (AT) antar (DOT) bryansk.ru> writes:
Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] ALTER TYPE ... USING(NULL) / NOT NULL violation - 07-10-2006 , 06:18 PM



"Alexander M. Pravking" <fduch (AT) antar (DOT) bryansk.ru> writes:
Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.