Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2006
    Posts
    43

    Unanswered: 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.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    no

    get around it with application code in most cases, foreign key to lookup table in some cases
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    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?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    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

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •