Bug 99345

Summary: Need chack constraints is ddl for booleans
Product: [Retired] Red Hat Web Application Framework Reporter: Dennis Gregorovic <dgregor>
Component: persistenceAssignee: Rafael H. Schloming <rafaels>
Status: CLOSED RAWHIDE QA Contact: Jon Orris <jorris>
Severity: medium Docs Contact:
Priority: medium    
Version: nightlyCC: tross
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-01 14:50:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 98546    

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.