Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I receive the following error for "emfield video field" when I save a node:
user warning: Column 'field_video_embed_version' cannot be null query: UPDATE content_field_video_embed SET vid = 7, nid = 7, field_video_embed_embed = NULL, field_video_embed_value = NULL, field_video_embed_provider = NULL, field_video_embed_data = 'N;', field_video_embed_version = NULL, field_video_embed_duration = NULL WHERE vid = 7 in D:\DEVELOPMENT\xampp\www\mysite\sites\all\modules\cck\content.module on line 1213.
As the error describes this message only to appears if the video field is empty.
I use a fresh Drupal 6.14 installation with CCK 2.5. I didn't hack the database or anything else.
Help is much appreciated.
Please let me know if you need more information.
Kind regards,
Stefan
Comments
Comment #1
design.er CreditAttribution: design.er commentedBTW: I use YouTube services in this field.
Comment #2
Ashford CreditAttribution: Ashford commentedUse phpMyAdmin to edit the fields. Click to check mark the box labeled "NULL". Do not change the default values.
Database Table & fields
content_field_video -- field_video_version, field_video_duration
content_field_audio -- field_audio_version
Comment #3
design.er CreditAttribution: design.er commentedHi Ashford, thank you for your quick response.
Sorry but I'm afraid I don't understand what you mean. Please can you describe what to do with the fields in phpMyAdmin?
Sorry for the circumstances.
Comment #4
TrevorG CreditAttribution: TrevorG commentedHi I fixed this.
Basically, as he said, go to phpMyAdmin
I changed this to a bug because I don't know how it can't be. I had a clean install of emfield, tried the dev even and it wasn't fixed. Don't know how more users aren't having issues with this. By the way, great module otherwise, thank you!
Comment #5
design.er CreditAttribution: design.er commentedSorry for the ultra delayed answer.
Attached is a screenshot if my phpMyAdmin. Please can you tell me if my phpMyAdmin is correct - I neither see a "NULL" checkbox (from comment #2) nor a field where I could replace "NULL" with "null" - only an integer field with the 0 - for the fields _version and _duration.
Maybe you could also post a screenshot with your values.
And, should I replace this values for every node extra?
Thanks a lot for your help.
Comment #6
shilpawaidya CreditAttribution: shilpawaidya commentedThanks a lot TrevorG.. I had the same issue and you instructions helped me solve it.
Comment #7
schnippy CreditAttribution: schnippy commentedI had the same issue using 6.x-1.18. The content wasn't saving when the video value was empty and this error message was in the log file:
Column field_fieldname_video_value cannot be null query: ...
I fixed this by altering the columns directly in MySQL (similar to the phpMyAdmin solutions above):
alter table content_type_typename modify `field_fieldname_video_value` varchar(255) default '';
I had to do this for _value and _provider for my content to save again. In the module code, is this where this 'NOT NULL' setting is set for the database field:
emfield.cck.inc: lines 19-22
Is it as simple as changing the settings to keep this from re-occuring or am I missing some other implication from allowing null data for an empty field? Is there a database update already for this?
Comment #8
skizzo CreditAttribution: skizzo commentedI am experiencing a similar error in 6.x-1.18. It happens when creating a node (emf Picasa image + emf Youtube video) which includes the image, while not including any video. Apparently the node creation completes successfully, the only side effect being the watchdog warning. Can I safely disregard this warning?
user warning: Column 'field_emb_videofield_00_version' cannot be null query: UPDATE content_field_emb_videofield_00 SET vid = 16486, nid = 16486, field_emb_videofield_00_embed = NULL, field_emb_videofield_00_value = NULL, field_emb_videofield_00_provider = NULL, field_emb_videofield_00_data = NULL, field_emb_videofield_00_version = NULL, field_emb_videofield_00_duration = NULL WHERE vid = 16486 in /var/www/drupal/sites/all/modules/cck/content.module on line 1213.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedThe issue still occurs in 6.x-1.19
The above-mentioned solutions with phpMyAdmin worked.
Comment #10
Cyberwolf CreditAttribution: Cyberwolf commentedSubscribing.
Comment #11
liquidcms CreditAttribution: liquidcms commentedi think for the D6 module the CCK "schema" for this field is defined correctly to allow null (see note below)
but, on my site at least where the D6 db was converted from a D5 site the mysql field is not set to allow null - however it also has a mysql default set as "empty string" (for D6 default is set to null).. and it therefore works correctly
from this i would have to assume that the D5 code for this field handled the no value case by letting mysql simply insert its empty string. in the d6 version of the code possibly the module inserts a null via php and therefore mysql tries to insert a null - which in a table originally created in D6 is fine as it accepts nulls; but in a D6 table converted from D5 it doesn't
hope that all made sense.
anyway.. solution above to manually allow for nulls should work.. but there should really be an update script to go through existing fields and set to allow for null.
ALSO... the D6 cck code for this field is a bit messed up. In emfield.cck.inc:
of course the setting 'not null' to TRUE and then writing over it with FALSE doesn't make much sense.
i could provide patch but i am not sure i have latest rev of the module.. i'll check..
Comment #12
notfound_old CreditAttribution: notfound_old commentedHad exactly the same problem, with 6.x-1.19 & postgres - unable to save node with "Query failed: ERROR: null value in column (...) violates not-null constraint in (...)" error messages in watchdog.
This helped:
ALTER TABLE content_type_ ALTER COLUMN field__video_version DROP NOT NULL;
ALTER TABLE content_type_ ALTER COLUMN field__video_duration DROP NOT NULL;
Comment #13
Balbo CreditAttribution: Balbo commented#4 worked for me.
Comment #14
NicolasH CreditAttribution: NicolasH commentedI needed something more robust than changing this manually, since I run an upgrade script every night from D5 to D6. It seems the update (6005) in emfield.install doesn't really attempt to change existing NULL settings of the different columns.
liquidcms' observations in #11 make sense, would be good to get a module maintainer's view on this.
Anyway, in my case I run this to change the settings throughout the DB for any instance of emfield video:
It's array('emvideo') because you can add other emfield types, but I haven't needed that and don't know the implications. You can run this as a snippet in Devel, but it would be best as an update in an .install file, in which case you don't need the includes at the top.
I would like to know whether this works for others...pls don't run this on a production site.
Comment #16
skizzo CreditAttribution: skizzo commentedChanging Version to 6.x-1.x-dev
(problem confirmed in 6.x-1.26)
Comment #17
Iho Tea CreditAttribution: Iho Tea commentedConfirm the problem in 6.x-2.4...
why? ;)
Comment #18
marta_yo CreditAttribution: marta_yo commented#4 Worked for me!
#5, maybe it's too late, but your problem is that you are editing the fields inside the table, you must edit the table estructure. See the screen capture attached.
Comment #19
arthurf CreditAttribution: arthurf commentedI believe this is an issue caused by mysql versions. If you look at http://bugs.mysql.com/bug.php?id=39265, it appears that versions 5.1 - 5.1.31 change the way that NULL works with an update when the column is defined as NOT NULL. I tested on 5.0.51a which worked correctly. 5.1.31 had the error described in this thread. 5.1.44 worked correctly.
The fix for this would be to change the column described in _emfield_field_columns(). I was able to confirm this by doing:
Obviously replace content and field names with the appropriate ones on your system. I'm a bit surprised this has not happened for more modules, but I'm pretty certain that the fix is correct because the error is only thrown on update and only for the mysql versions described here.
Comment #20
electblake CreditAttribution: electblake commentedThanks @TrevorG, worked like a charm :)
Comment #21
Rade CreditAttribution: Rade commented#4 worked like a charm!
Thanks!
Comment #22
pcorbett CreditAttribution: pcorbett commentedExperienced same issue discussed in MySQL 5.1.41-3ubuntu12.3. Manually ran
ALTER TABLE {content_type_[my_content_type]} CHANGE `field_[my_content_type]_video_version` `field_[my_content_type]_video_[version, provider, value, etc.]` INT( 10 ) NULL DEFAULT '0';
to allow NULLs in respective columns. Works as reported above. I had also tried upgrading to 6.x-2.x-dev and experienced the same issue.
Comment #23
kriskhaira CreditAttribution: kriskhaira commented#4 worked for me with 6.x-2.x-dev. Thanks!
Comment #24
ShaneOnABike CreditAttribution: ShaneOnABike commentedWow this suddenly appeared out of nowhere for us I think since we upgraded the module. I can confirm this is an issue although I had to use the following to make the approriate changes.
And the same for all the other not null values.
We should really fix this it's pretty serious?
Comment #25
ShaneOnABike CreditAttribution: ShaneOnABike commentedOne thing that I would note though is now when I save fields empty ones are saved. So when using lightbox with this it always renders a link... probably a bug in lightbox so I'll report there but I thought I would mention it anyway.
Comment #26
wojtha CreditAttribution: wojtha commented#22 Worked for me at 6.x-2.5. Thanks.
Seems that the same problem also in the dev version according to #23.
Marking as major, since it breaks node update - other fields aren't updated.
Comment #27
CMStom CreditAttribution: CMStom commented#4 worked perfectly! Thanks for sharing!
Comment #28
marcoBauli CreditAttribution: marcoBauli commented#4, #5 and #18 helped, thanks
Comment #29
ShaneOnABike CreditAttribution: ShaneOnABike commentedMaybe we should add this to the install?