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 >>> >>> >>> On Nov 28, 2011, at 4:00 PM, Kieran Kelleher wrote: >>> >>>> What database platform? >>>> >>>> On Nov 28, 2011, at 3:37 PM, James Cicenia wrote: >>>> >>>>> Hello - >>>>> >>>>> A random problem has started cropping up in our very old reliable >>>>> application. >>>>> I have a to-one relationship with nullify as its delete rule and on the >>>>> to-many side >>>>> I have a cascade delete rule. >>>>> >>>>> But, somehow, the id is getting set to ZERO which causes all kinds of >>>>> havoc. >>>>> >>>>> Any thoughts? >>>>> >>>>> Thanks >>>>> James >>>>> >>>>> _______________________________________________ >>>>> Do not post admin requests to the list. They will be ignored. >>>>> Webobjects-dev mailing list ([email protected]) >>>>> Help/Unsubscribe/Update your Subscription: >>>>> http://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com >>>>> >>>>> This email sent to [email protected] >>>> >>> >>> _______________________________________________ >>> Do not post admin requests to the list. They will be ignored. >>> Webobjects-dev mailing list ([email protected]) >>> Help/Unsubscribe/Update your Subscription: >>> http://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com >>> >>> This email sent to [email protected] >> > > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list ([email protected]) > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com > > This email sent to [email protected]
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
