List:MySQL and Java« Previous MessageNext Message »
From:Mark Matthews Date:May 29 2003 9:49pm
Subject:Re: Enum Type...
View as plain text  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Zhao, Charles wrote:

> I had a similar question like this.  So if you insert an illegal value
> into a ENUM column, it will be automatically set to ""?  That's not good
> for me.  I was hoping if it's illegal value then the db should give me
> an error msg and reject the record.

The problem is, how do you make 'rejections' work with non-transactional
tables (like MyISAM, which is the default table type in MySQL)?

You have to remember that relational databases do operations as 'sets',
not on a record-by-record basis, so thinking in a record-by-record way
is sometimes going to lead you down the wrong path. MySQL can't reject a
record, because changes might have already been done to it can be
'rolled back', as parts of it might have already been updated.

See http://www.mysql.com/doc/en/constraint_NOT_NULL.html for the full
explanation (which is linked to from the documentation for 'ENUM' and
'SET' types as well).

	-Mark
- --
For technical support contracts, visit https://order.mysql.com/?ref=mmma

    __  ___     ___ ____  __
   /  |/  /_ __/ __/ __ \/ /  Mark Matthews <mark@stripped>
  / /|_/ / // /\ \/ /_/ / /__ MySQL AB, SW Dev. Manager - J2EE/Windows
 /_/  /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
        <___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+1oB8tvXNTca6JD8RAkdZAKCck5xxw/1AEhPyKFLvGgPyLE+7iwCfR29C
mFf717wj0ln6auf5kdgSOGg=
=E/V7
-----END PGP SIGNATURE-----

Thread
Enum Type...harsh29 May
  • Re: Enum Type...Nick Scholtz29 May
    • Re: Enum Type...harsh30 May
      • Re: Enum Type...Mark Matthews30 May
RE: Enum Type...Charles Zhao29 May
  • Re: Enum Type...Mark Matthews29 May
RE: Enum Type...Charles Zhao30 May
Re: Enum Type...Eric Raymond1 Jun