Bug 99345 - Need chack constraints is ddl for booleans
Summary: Need chack constraints is ddl for booleans
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Web Application Framework
Classification: Retired
Component: persistence
Version: nightly
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Rafael H. Schloming
QA Contact: Jon Orris
URL:
Whiteboard:
Depends On:
Blocks: 98546
TreeView+ depends on / blocked
 
Reported: 2003-07-17 22:03 UTC by Dennis Gregorovic
Modified: 2014-12-01 23:13 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-08-01 14:50:18 UTC
Embargoed:


Attachments (Terms of Use)

Description Dennis Gregorovic 2003-07-17 22:03:22 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030303

Description of problem:
boolean fields are currently stored in the db as char(1) columns.  The expected
value is either '0' or '1'.  As such, the ddl generator should add check
constraints to the ddl to ensure that '0' and '1' are the only possible values
entered.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. open ddl/{oracle-se,postgres}/table-cat_categories-auto.sql
2. 
3.
    

Actual Results:  create table cat_categories (
    category_id INTEGER not null
        constraint cat_categori_catego_id_p_yeprq
          primary key,
        -- referential constraint for category_id deferred due to circular
dependencies
    description VARCHAR(4000),
    name VARCHAR(200) not null,
    url VARCHAR(200),
    enabled_p CHAR(1) not null,
    abstract_p CHAR(1) not null,
    default_ancestors VARCHAR(3209) not null
);


Expected Results:  create table cat_categories (
    category_id INTEGER not null
        constraint cat_categori_catego_id_p_yeprq
          primary key,
        -- referential constraint for category_id deferred due to circular
dependencies
    description VARCHAR(4000),
    name VARCHAR(200) not null,
    url VARCHAR(200),
    enabled_p CHAR(1) not null
        constraint <constraint_name> 
        check(enabled_p in ('0','1')),
    abstract_p CHAR(1) not null
        constraint <constraint_name> 
        check(abstract_p in ('0','1')),
    default_ancestors VARCHAR(3209) not null
);


Additional info:

Comment 1 Dennis Gregorovic 2003-07-29 22:10:42 UTC
I've confirmed that the check constraint is added correctly.  However, could we
add names for the constraints?  This would make upgrade scripts easier.


Note You need to log in before you can comment on or make changes to this bug.