I have add 'number_decimal' field to content and make it 'select list'. Then, I create new content of this type, but left this field empty. When I click 'Save', I've got an error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE vid = 1' at line 1 query: UPDATE content_type_company SET vid = 1, nid = 1, field_decimal_value = NULL, field_language_value = 'ru', field_time_zone_value = WHERE vid = 1 in D:\portal\drupal\www\sites\all\modules\cck\content.module on line 1026.
It seems that, when decimal number field are presented in select list, update query didn't include NULL in case of empty value.
Comments
Comment #1
karens commentedYou created a select list that has no allowed values? Why would you do that? Plus the problem in the SQL above is not the field_decimal_value being null but the field_time_zone_value being missing, which is a different thing (unless that field is a decimal field). And you said you are creating a new node and the SQL is for an update, not an insert, so this report is generally very confusing.
At any rate, I can create a decimal field using the select widget, give it no allowed values, and leave it empty, and it works fine.
Bump up to the very latest development code and if you still have problems provide an export of your content type and fields to show how they are set up.
Comment #2
beholder commentedSorry for my poor english, maybe I wasn't clear enough. I mean that I have created a field (with widget type = select list) and add some values to it. But when I create a node of this type (with this field, which has 'field_time_zone_value' name, as you've pointed) - and then I've got this error.
Now, I decided to make a new clean test. I have download and install clean copy of Drupal 6.2, install latest CCK 6.x-2.0-beta and create a new type of content. I've named it 'company'. Then, I've added just one field to it - 'field_number'. It's a number_decimal field with 'select list' widget. I've added values to it - '1, 2, 3, 4, 5' (in textarea 'Allowed values list' - each on new line). I didn't check 'Required' checkbox - so I think I can just ignore this field upon node creation (it will allow empty value). Then, I've save this field and go to 'create new content' page. There I have add new node of this type ('company'), add title to it, BUT didn't select any value in field_number list. I have press 'Save' and then again this error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: INSERT INTO content_type_company (vid, nid, field_number_value) VALUES (1, 1, ) in D:\portal\drupal\www\sites\all\modules\cck\content.module on line 1084.You was right about UPDATE query instead of INSERT. When I save new node, I've got this error (with INSERT), but when I go to edit this node and again - didn't select any value in list - there is another error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE vid = 1' at line 1 query: UPDATE content_type_company SET vid = 1, nid = 1, field_number_value = WHERE vid = 1 in D:\portal\drupal\www\sites\all\modules\cck\content.module on line 1084.So, I hope you can repeat my steps and get same errors to find bug. I just want to create list of decimal numbers that is not required to fill - with allowed empty value.
There is my export for this node type and field:
Comment #3
dopry commented6.x-1.x is no longer supported... reopen and update version if this still affects 6.x-2.x