• 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: Kieran Kelleher <email@hidden>
  • Date: Tue, 29 Nov 2011 10:29:57 -0500

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

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
  • Follow-Ups:
    • Re: What causes a ZERO in the ID ?
      • From: James Cicenia <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>)

  • Prev by Date: Re: Does wonder have a standard User framework?
  • Next by Date: Re: Problem loading Ajax frameworks
  • Previous by thread: Re: What causes a ZERO in the ID ?
  • Next by thread: Re: What causes a ZERO in the ID ?
  • Index(es):
    • Date
    • Thread