Hi Peter, all!

Peter Matulis wrote:
--- Joerg Bruehe <[EMAIL PROTECTED]> wrote:

[[...]]
CREATE TABLE users (
 id PRIMARY KEY,
 priority integer NOT NULL DEFAULT '7',
 policy_id  integer unsigned NOT NULL DEFAULT '1',

Even though this may work, it is wrong IMNSHO:
You set character strings as default values for numeric columns!
Your strings consist of digits only, so they can (and will) be
converted to numbers, but IMO you should not make use of that.


I don't understand.  I have integer there.  Where is character strings?

The column type is integer, right. But the default values '7' and '1' are strings, by their quotes; only the unquoted numbers 7 and 1 would be integer.

I know that MySQL silently converts, if possible.

I was not aware of the quoting that happens in the "SHOW CREATE TABLE" output which Harald then showed - sorry. So it is quite possible that Peter gave plain integer default values but then used an output in his mail which had got the quotes added. Please accept my apologies for this.

Joerg

--
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to