When I export then import my fields from one Content Type to another, I get errors on text fields. Looking into it so far this is what I have been able to determine:
The error and SQL is this when reported by Drupal:

Error #: 1062
Error: Duplicate entry '28' for key 1

Query: 
INSERT INTO content_field_body_content_title (vid, nid, field_body_content_title_value, field_body_content_title_format) 
SELECT vid, nid, field_body_content_title_value, field_body_content_title_format 
FROM content_type_page

However, when trying this statement directly on the DB I get a different error - I have no idea why the error is different:

INSERT INTO content_field_body_content_title( vid, nid, field_body_content_title_value, field_body_content_title_format )
SELECT vid, nid, field_body_content_title_value, field_body_content_title_format
FROM content_type_page

MySQL said: #1054 - Unknown column 'field_body_content_title_value' in 'field list' 

Looking at this it looks like the error would be coming from the SELECT part of the SQL, so just to verify, here's the DB's response to the SELECT:

SELECT vid, nid, field_body_content_title_value, field_body_content_title_format
FROM content_type_page

Following is the import text
MySQL said: #1054 - Unknown column 'field_body_content_title_value' in 'field list' 

Attached in the import text created by exporting the field.

CommentFileSizeAuthor
imported-cck-field.txt3.73 KBreg

Comments

reg’s picture

Almost forgot, versions: PHP 5, MySQL 5, Apache 2, Drupal 6.

reg’s picture

Found more out. The field that's missing was there but was deleted in the process of making it global - I did a complete comparison of the DB of before and after the import. This looks like an issue of ordering of calls. Could just be that a module weight change could fix this but I have no idea which to change to what.

Also, this suggest there might be a workaround where you could:
- create a dummy content type
- import into it - that would effect the change to all the fields to global types
- do a real import into the content type you want to use
- delete the dummy content type

I will try this and post the results.

reg’s picture

That worked. Curiously, it even (seemingly) fixed up the problems with the dummy content type so this might be a quick fix in some cases as well.