Closed (fixed)
Project:
Phone
Version:
6.x-2.9
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 May 2007 at 18:46 UTC
Updated:
10 Nov 2009 at 22:00 UTC
Jump to comment: Most recent file
In strict mode, MySQL cannot accept an empty string when a field's "not null" property is set to TRUE. This can cause MySQL errors to be thrown in certain situations.
As far as I know there is no downside to setting 'not null'->FALSE, many CCK core fields do that now.
Patch attached, this is my first patch submission! Let me know if you need anything :)
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | phone.module.6.x.patch | 187 bytes | darrellduane |
| phone.module.patch | 756 bytes | gdd |
Comments
Comment #1
neilnz commentedI can confirm this is also an issue with the D6 version. Running on a PostgreSQL database, this prevents the node from being created because the database says you're trying to insert null into a not-null field. Example error from watchdog:
The trigger for this error is either programmatically creating nodes without the phone field set (which is fine if it's not a "required" field), for example using node_import to import content. Another cause is using something like the content_permissions module that ships with CCK to turn off the phone field for some roles, so the value isn't submitted.
I imagine the patch remains similar to the one already attached, and it needs to be applied as this causes complete breakage on Postgres in the mentioned circumstances.
Comment #2
neilnz commentedComment #3
darrellduane commentedI agree. Adding on to request this change be made.
I can't load data that I've exported because of this constraint. c: Here is a patch file for 6.x version
Comment #4
drewish commentedDo we need an update function to change this on existing fields?
Comment #5
neilnz commentedYes that's probably a good idea. Would anyone like to re-craft the patch? I can if noone else wants to.
Comment #6
Steve Dondley commented+1
This issue causes a problem with node profile module when hiding the phone on the registration field: http://drupal.org/node/514080
Comment #7
uomeds commentedI am using the phone cck in advanced profile kit but the field is not visible upon registration. Nonetheless, when new users sign up, they are greeted with this error message.
I patched not null TRUE to FALSE. But it didn't help existing fields. I just tried deleting all the phone fields and re-creating them and it seems to work now.
Comment #8
thierry_gd commentedTaken into account in 6.2.9 version
Comment #9
DanielJohnston commentedI'm getting the following when saving a node with no content in the phone field:
user warning: Column 'field_phonenumber_value' cannot be null query: INSERT INTO content_field_phonenumber (vid, nid, field_phonenumber_value) VALUES (107, 95, NULL) in /srv/welfaretowork.co.uk/public/htdocs/sites/all/modules/cck/content.module on line 1213.Suspect this bug may still be alive?
Comment #10
DanielJohnston commentedOops. Forgot to mention I'm using latest versions of all modules, including Phone (CCK) 6.x-2.9
Comment #11
DanielJohnston commentedUpdate - I've fixed the problem by removing then readding the offending field. No idea what went wrong the first time round. Apologies for the trouble...
Comment #12
jrefano commentedLooks like this bug still exists. I just updated from 2.8 to 2.9 and my phone fields would throw the following error
user warning: Column 'field_phone_value' cannot be null query: INSERT INTO content_type_personnel (vid, nid, field_title_value, field_phone_value, field_email_email, field_personnel_photo_fid, field_personnel_photo_list, field_personnel_photo_data) VALUES (250, 250, 'Dramaturg', NULL, NULL, NULL, NULL, NULL) in /Users/john/canary/wilma/sites/all/modules/cck/content.module on line 1213.I had to delete the field and re-create. I think the new version just needs to run an update on the existing fields to make them accept null values.
Comment #13
jrefano commentedForgot to make it active
Comment #14
akolahi commentedI upgraded from 2.8 to 2.9 and I am also getting the user warning 'cannot be null'.
Comment #15
nathaniel commentedA query needs to be run to update all old phone fields. I only had one so I jumped in the database and changed it manually. Set Null to Yes Null and everything works swimmingly.
Comment #16
thierry_gd commentedFixed in 6.2.10 release