I created a content type called Distance. In this content type, I added a field called field_distance_km. I used this field in a new content type called Race part. I later removed the Distance content type.

Now when editing race parts, I get the following when submitting:

user warning: Unknown column 'field_distance_km_value' in 'field list' query: INSERT INTO content_type_race_part (vid, nid, field_distance_km_value, field_distance_miles_value) VALUES (5, 5, 21, 13.1) in /Library/WebServer/Documents/drupal-6.4/modules/cck/content.module on line 1099.

I can work around this because I have very little content, so can just delete field_distance_km and replace with a new one. However, perhaps users should be warned before deleting content types containing fields in use elsewhere, or there should be something to cope with it.

Comments

KarenS’s picture

When you deleted the content type you would have gotten a message that you had data for that content type and that deleting it would create problems. When you delete a content type that has data, all the CCK field definitions and data remain because core does not delete those nodes. That's probably a core bug and there is an issue somewhere about that.

CCK leaves that data alone because core does. But that leaves your database in an odd state. You have 'orphan' data for a content type that is gone and a field definition for that data that says it is still shared.

I'm not sure anyone has explicitly tested what happens to shared fields one content type is removed, so this does need investigation.

yched’s picture

Strange, I cannot reproduce this, even using the exact creation sequence described in the original post :
Create type_A, add field_foo (Integer, tested both single and multiple), create node_A
Create type_B, share the field_foo field, create node_B
Remove type_A
=> the db layout is then updated as expected (field_foo data migrated back to the per-type table for type_B if the field is single, or kept in a per-field table if the field is multiple)
=> editing node_B works OK.

willdyke - did you try clearing your site's cache ? (admin/settings/performance, 'clear cached data' at the bottom of the page)

matt_paz’s picture

I have an issue on the same line number, but CCK is only reporting ...
user warning: in \sites\all\modules\contrib\cck\content.module on line 1099
in rc7 and in dev, I'm getting it on ...
user warning: in \sites\all\modules\contrib\cck\content.module on line 1141

Interestingly, it doesn't occur on all node saves ... so, I think I'm missing some data on some occasions, but I haven't been able to isolate the point of failure yet. Only around 1 in 7 of my nodes fail ... there has to be a pattern, but I just can't identify it yet. My comments on this ticket probably aren't very helpful, but I thought I'd go ahead and share some similar findings.

Interestingly, when it fails, the node still saves ... I get proper data in node and node revisions ... and in a mutliple item cck field ... but not the core content type cck table (in my case, content_type_source_code) ... there is simply no record for a corresponding nid there.

matt_paz’s picture

Okay ... I have an update on this ... it looks like it was a character encoding issue on I'm not sure where this should be handled ... in CCK or in code feeding data to CCK. In any event, I ran the suspect data through mb_convert_encoding and it seems to be working fine now. Not sure if a separate ticket should be opened up for that or not.

yched’s picture

matt_paz : yes, if you provide a detailed step-by-step description of what you do and the exact error messages you get.
You issue is most probably not related to the one in this thread.

matt_paz’s picture

yched: Heh, probably not as detailed as might be ideal, but I went ahead and filed another ticket.
http://drupal.org/node/311548

KarenS’s picture

Status: Active » Postponed (maintainer needs more info)

Waiting for feedback from the original poster.

willthames’s picture

No, I did not attempt to clear the cache at that time.

JKingsnorth’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

This is an older issue that has not been revisited so I'm going to close it off.