• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What causes a ZERO in the ID ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What causes a ZERO in the ID ?


  • Subject: Re: What causes a ZERO in the ID ?
  • From: James Cicenia <email@hidden>
  • Date: Tue, 29 Nov 2011 10:12:40 -0600

Thanks for the heads up on that. I will do that on before the weekly restart.

Thanks

On Nov 29, 2011, at 9:54 AM, Kieran Kelleher wrote:

FYI, If you don't set strict sql-mode, your NOT NULL ints will still silently get a DEFAULT '0' even though you did not specify that in your create statement!


On Nov 29, 2011, at 10:42 AM, James Cicenia wrote:

I addressed (1) last night. 

Though I don't know why it would get '0' or even null. 
This will prevent the users from having problems, now
I need to track down under what circumstance this occurs.

Thanks
James


On Nov 29, 2011, at 9:29 AM, Kieran Kelleher wrote:

Hi James,

So my guess is one, or a combination of the following conditions, are causing your problem:

(1) Your PK fields are defined as 
`id` INT(11) NOT NULL DEFAULT '0'

instead of

`id` int(11) NOT NULL

(2) All or some of your tables are MyISAM (non-transactional tables originally intended for data logging applications) when they should be InnoDB (Transactional).

(3) You are not running in "STRICT" SQL mode, which would cause the DEFAULT '0' to get attached automatically in your create table statement (item #1 indirect cause)
Strict SQL mode can be implemented by adding options to /etc/my.cnf config file and restarting

sql-mode = STRICT_ALL_TABLES

This mode eliminates the entire "silent defaults and silent string truncation" behavior that is the stupid default setting, and probably must remain the default setting for backward compatibility.

(4) If an FK (Foreign Key) is getting set to zero and you wish it to be nullable then it should be defined as:
`foreign_id` int(11) DEFAULT NULL


Hope that helps,

-Kieran

On Nov 28, 2011, at 8:15 PM, James Cicenia wrote:

MySQL


James

smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >What causes a ZERO in the ID ? (From: James Cicenia <email@hidden>)
 >Re: What causes a ZERO in the ID ? (From: Kieran Kelleher <email@hidden>)
 >Re: What causes a ZERO in the ID ? (From: James Cicenia <email@hidden>)
 >Re: What causes a ZERO in the ID ? (From: Kieran Kelleher <email@hidden>)
 >Re: What causes a ZERO in the ID ? (From: James Cicenia <email@hidden>)
 >Re: What causes a ZERO in the ID ? (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: What causes a ZERO in the ID ?
  • Next by Date: Re: Problem loading Ajax frameworks
  • Previous by thread: Re: What causes a ZERO in the ID ?
  • Next by thread: AjaxFileUpload UploadProgress binding
  • Index(es):
    • Date
    • Thread