If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Check Constraints

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-07-06, 22:51
vk101 vk101 is offline
Registered User
 
Join Date: Mar 2006
Posts: 43
Check Constraints

Are check constraints being introduced in 5.0 of MySQL? I saw some webpages that seem to say that's the case, but when doing a search on the MySQL website, no hits seem to come up for check constraints.

Have check constraints already been introduced, or are they planning to be introduced anytime soon?

It seems like a pretty basic and commonly used feature, so I'm surprised that it's not present in MySQL...what do you do to get around it? Triggers?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 08-08-06, 04:07
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
no

get around it with application code in most cases, foreign key to lookup table in some cases
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 08-08-06, 10:12
vk101 vk101 is offline
Registered User
 
Join Date: Mar 2006
Posts: 43
When you say application code, you mean assume that the DB has 'unchecked' data (i.e. not passed through CHECK constraint, such as assuming a number is less than 1000), and instead check for the values in the application code itself?
Reply With Quote
  #4 (permalink)  
Old 08-08-06, 10:42
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
yup, you got it -- when i said application code, that's what i meant

except the application code wouldn't actually let the unchecked data get into the database in the first place
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 08-09-06, 00:10
vk101 vk101 is offline
Registered User
 
Join Date: Mar 2006
Posts: 43
In the following link, under "New Features in MySQL 5.1", it says "Column level constraints"...is this a CHECK constraint, or something else?

http://www.databasejournal.com/featu...le.php/2210771
Reply With Quote
  #6 (permalink)  
Old 08-09-06, 00:33
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
note the date on that article -- written back in the steam-powered web server days

always go to the source -- in this case the mysql.com site

http://dev.mysql.com/doc/refman/5.1/...nts-table.html
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On