Unix Technical Forum

BUG #1433: domain check constraint not checked when adding new column

This is a discussion on BUG #1433: domain check constraint not checked when adding new column within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 1433 Logged by: craig perras Email address: craigp98072@yahoo.com PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 09:29 AM
craig perras
 
Posts: n/a
Default BUG #1433: domain check constraint not checked when adding new column


The following bug has been logged online:

Bug reference: 1433
Logged by: craig perras
Email address: craigp98072@yahoo.com
PostgreSQL version: 8.0 release
Operating system: win2000
Description: domain check constraint not checked when adding new
column
Details:

Domain check constraint not checked when adding new column.

repro:
add domain 'string' of base type text with non-null constraint
add column of type 'string' to table with existing rows
works; all rows have new column's value set to null

expected:
error: cannot add column due to non-null constraint in domain 'string'

notes:
could not insert a new row with non-null value for 'string' column (as
expected)
trying to add a column of type text with non-null constraint produces
expected error message

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 09:29 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #1433: domain check constraint not checked when adding new column

"craig perras" <craigp98072@yahoo.com> writes:
> Domain check constraint not checked when adding new column.


Hmm. It does work for cases like

regression=# create domain posint int check (value > 0);
CREATE DOMAIN
regression=# alter table foo add column f5 posint default 0;
ERROR: value for domain posint violates check constraint "posint_check"

I think the issue is that when you don't specify any default, the scan
of the table gets optimized away.

regards, tom lane

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 09:29 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #1433: domain check constraint not checked when adding new column

"craig perras" <craigp98072@yahoo.com> writes:
> add domain 'string' of base type text with non-null constraint
> add column of type 'string' to table with existing rows
> works; all rows have new column's value set to null


Fixed for 8.0.1.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:05 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com