Bug 99345 - Need chack constraints is ddl for booleans
Need chack constraints is ddl for booleans
Status: CLOSED RAWHIDE
Product: Red Hat Web Application Framework
Classification: Retired
Component: persistence (Show other bugs)
nightly
All Linux
medium Severity medium
: ---
: ---
Assigned To: Rafael H. Schloming
Jon Orris
:
Depends On:
Blocks: 98546
  Show dependency treegraph
 
Reported: 2003-07-17 18:03 EDT by Dennis Gregorovic
Modified: 2014-12-01 18:13 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-08-01 10:50:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dennis Gregorovic 2003-07-17 18:03:22 EDT
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 18:10:42 EDT
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.