Selecting a group for a field in the 'manage fields' tab and then clicking the 'update' button does nothing.
Selecting the same group for more than one field and then clicking the 'update' button causes a warning like the following one to appear for each item but the first:
user warning: Duplicate entry 'ciclogita-group-logistica-' for key 1 query: INSERT INTO arl_node_group_fields (type_name, group_name, field_name) VALUES ('my content type name', 'my group name', '') in /var/www/drupal5/includes/database.mysql.inc on line 167.

Comments

karens’s picture

Something is seriously wrong with your installation. You have a content type name with spaces in it, a group name with spaces in is and a non-existant field name. It should not be possible for any of those names to be created. Have you manually changed anything in any of your tables? How did you create that content type? Is it coming from some other module or did you create it yourself, or did you maybe try changing the name of a content type? Was this a fresh install or an update? Did you go to update.php and run all updates?

karens’s picture

Also, install the content_copy module and export this content type and past the results here. That may help us debug this.

karens’s picture

After investigating http://drupal.org/node/112944, I wonder if that is related. That bug could have created a table name with spaces in it, but shouldn't have created a group name with a space, so I'm not clear yet if this is what the problem is.

Can you confirm that your error message actually said ...VALUES ('my content type name', 'my group name', '')... and that you didn't just substitute that text in for the real names when you posted your message.

tiziano’s picture

As you supposed, I just substituted the names when I posted your message. This is the really user warning I get:

user warning: Duplicate entry 'ciclogita-group-iscrizioni-' for key 1 query: INSERT INTO arl_node_group_fields (type_name, group_name, field_name) VALUES ('ciclogita', 'group-iscrizioni', '') in /var/www/drupal5/includes/database.mysql.inc on line 167.

And this is my content type definition:

$content[type]  = array (
  'name' => 'ciclogita',
  'type' => 'ciclogita',
  'description' => '',
  'title_label' => 'Denominazione',
  'body_label' => '',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
    'moderate' => false,
  ),
  'comment' => '2',
  'upload' => '1',
  'event_nodeapi' => 'never',
  'fivestar' => 1,
  'fivestar_position' => 'above',
  'image_attach' => '1',
  'jrating_nodeapi' => '0',
  'pdfview' => '1',
  'scheduler' => 0,
  'old_type' => 'ciclogita',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'ant' => 0,
  'ant_pattern' => '',
  'ant_php' => 0,
  'node_images_position' => 'node_template',
  'node_images_gallery_link' => '1',
  'node_images_teaser_images' => '2',
  'node_images_body_images' => '',
  'node_images_teaser_format' => 'thumbs',
  'node_images_body_format' => 'thumbs',
  'taxonomy_context_inline' => '0',
  'taxonomy_context_breadcrumb' => '0',
);
$content[groups]  = array (
  0 => 
  array (
    'label' => 'Programma',
    'settings' => 
    array (
      'collapsible' => 1,
      'collapsed' => 0,
    ),
    'description' => '',
    'weight' => '-4',
  ),
  1 => 
  array (
    'label' => 'Orari',
    'settings' => 
    array (
      'collapsible' => 0,
      'collapsed' => 0,
    ),
    'description' => '',
    'weight' => '-3',
  ),
  2 => 
  array (
    'label' => 'Logistica',
    'settings' => 
    array (
      'collapsible' => 1,
      'collapsed' => 0,
    ),
    'description' => '',
    'weight' => '-2',
  ),
  3 => 
  array (
    'label' => 'Iscrizioni',
    'settings' => 
    array (
      'collapsible' => 1,
      'collapsed' => 0,
    ),
    'description' => '',
    'weight' => '-1',
  ),
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'options_select',
    'label' => 'Luogo partenza',
    'weight' => '-5',
    'description' => 'Selezionare una voce dall\'elenco; se la voce necessaria non è presente, aggiungerla all\'elenco',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '1|Pordenone, stazione FS
2|Pordenone, parcheggio Marcolin
3|Pordenone, piazzale San Lorenzo
4|Pordenone, parco San Valentino
5|Pordenone, piazzale Sacro Cuore',
    'allowed_values_php' => '',
    'field_name' => 'field_luogo_partenza',
    'field_type' => 'text',
    'module' => 'text, optionwidgets',
  ),
  1 => 
  array (
    'widget_type' => 'options_select',
    'label' => 'Luogo rientro',
    'weight' => '-3',
    'description' => 'Selezionare voce dall\'elenco',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '1|Pordenone, stazione FS
2|Pordenone, parcheggio Marcolin
3|Pordenone, piazzale San Lorenzo
4|Pordenone, parco San Valentino
5|Pordenone, piazzale Sacro Cuore',
    'allowed_values_php' => '',
    'field_name' => 'field_luogo_rientro',
    'field_type' => 'text',
    'module' => 'text, optionwidgets',
  ),
  2 => 
  array (
    'widget_type' => 'number',
    'label' => 'Costo iscrizione (in €)',
    'weight' => '-2',
    'description' => 'Inserire l\'importo in Euro',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'min' => '',
    'max' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_costo_iscrizione',
    'field_type' => 'number_decimal',
    'module' => 'number',
  ),
  3 => 
  array (
    'widget_type' => 'options_select',
    'label' => 'Livello difficoltà',
    'weight' => '-2',
    'description' => 'Selezionare dall\'elenco',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '1',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '1|1 - Facile
2|2 - Medio
3|3 - Impegnativo
4|4 - Molto impegnativo',
    'allowed_values_php' => '',
    'field_name' => 'field_livello_diff',
    'field_type' => 'text',
    'module' => 'text, optionwidgets',
  ),
  4 => 
  array (
    'widget_type' => 'number',
    'label' => 'Lunghezza complessiva',
    'weight' => '-2',
    'description' => 'Indicare il tot. km',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'min' => '',
    'max' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_lunghezza_complessiva',
    'field_type' => 'number_integer',
    'module' => 'number',
  ),
  5 => 
  array (
    'widget_type' => 'text',
    'label' => 'Supplementi',
    'weight' => '-1',
    'rows' => '1',
    'description' => 'Per ogni tipo di supplemento, inserire l\'importo seguito dalla causale',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '0',
    'multiple' => '1',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_supplementi',
    'field_type' => 'text',
    'module' => 'text',
  ),
  6 => 
  array (
    'widget_type' => 'text',
    'label' => 'Tipo percorso',
    'weight' => '-1',
    'rows' => '1',
    'description' => 'Inserire le caratteristiche del percorso (es. fondo stradale, livello di traffico, dislivello, ecc.)',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_tipo_percorso',
    'field_type' => 'text',
    'module' => 'text',
  ),
  7 => 
  array (
    'widget_type' => 'date_js',
    'label' => 'Data partenza',
    'weight' => '0',
    'description' => '',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'granularity' => 
    array (
      'Y' => 'Y',
      'M' => 'M',
      'D' => 'D',
    ),
    'input_format' => 'site-wide',
    'input_format_custom' => '',
    'output_format_date' => 'd/m/Y - H:i',
    'output_format_zone' => '',
    'output_format_custom' => 'd/m/Y',
    'output_format_date_long' => 'l, j F, Y - H:i',
    'output_format_zone_long' => '',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, d/m/Y - H:i',
    'output_format_zone_medium' => '',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'd/m/Y - H:i',
    'output_format_zone_short' => '',
    'output_format_custom_short' => '',
    'tz_handling' => 'gmt',
    'field_timezone' => 'Europe/Rome',
    'field_name' => 'field_data_partenza',
    'field_type' => 'date',
    'module' => 'date',
  ),
  8 => 
  array (
    'widget_type' => 'computed',
    'label' => 'durata',
    'weight' => '0',
    'description' => '',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '0',
    'multiple' => '0',
    'code' => '$node_field[0][\'value\'] = $node->field_fine_gita[0][\'value\'] ? 1 + intval(strtotime($node->field_fine_gita[0][\'value\'])/86400) -
intval(strtotime($node->field_data_partenza[0][\'value\'])/86400) : 1;',
    'display' => '$node_field[0][\'value\'] = $node->field_fine_gita[0][\'value\'] ? 1 + intval(strtotime($node->field_fine_gita[0][\'value\'])/86400) -
intval(strtotime($node->field_data_partenza[0][\'value\'])/86400) : 1;',
    'display_format' => '$display = $node_field_item[\'value\'];',
    'store' => 1,
    'data_type' => 'int',
    'data_length' => '4',
    'data_default' => '',
    'data_not_null' => 0,
    'data_sortable' => 1,
    'field_name' => 'field_durata',
    'field_type' => 'computed',
    'module' => 'computed_field',
  ),
  9 => 
  array (
    'widget_type' => 'text',
    'label' => 'Presentazione',
    'weight' => '0',
    'rows' => '5',
    'description' => '<p>				Una breve descrizione della gita / escursione			</p>',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'text_processing' => '1',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_presentazione',
    'field_type' => 'text',
    'module' => 'text',
  ),
  10 => 
  array (
    'widget_type' => 'text',
    'label' => 'Dettaglio programma',
    'weight' => '1',
    'rows' => '20',
    'description' => 'Il dettaglio del programma (in particolare, per le gite di più giorni)',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '0',
    'multiple' => '0',
    'text_processing' => '1',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_dettaglio_programma',
    'field_type' => 'text',
    'module' => 'text',
  ),
  11 => 
  array (
    'widget_type' => 'date_text',
    'label' => 'Ora partenza',
    'weight' => '1',
    'description' => '',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '0',
    'multiple' => '0',
    'granularity' => 
    array (
      'Y' => 'Y',
      'M' => 'M',
      'D' => 'D',
      'H' => 'H',
      'N' => 'N',
    ),
    'input_format' => 'site-wide',
    'input_format_custom' => '',
    'output_format_date' => 'd/m/Y - H:i',
    'output_format_zone' => '',
    'output_format_custom' => 'G:i',
    'output_format_date_long' => 'l, j F, Y - H:i',
    'output_format_zone_long' => '',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, d/m/Y - H:i',
    'output_format_zone_medium' => '',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'd/m/Y - H:i',
    'output_format_zone_short' => '',
    'output_format_custom_short' => '',
    'tz_handling' => 'gmt',
    'field_timezone' => 'Europe/Rome',
    'field_name' => 'field_ora_partenza',
    'field_type' => 'date',
    'module' => 'date',
  ),
  12 => 
  array (
    'widget_type' => 'options_select',
    'label' => 'Tipo bici',
    'weight' => '1',
    'description' => 'Indicare le caratteristiche che deve avere la bicicletta (es. MTB, tripla volantina, City Bike)',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '1|con cambi, equipaggiata per piccole riparazioni
2|con tripla volantina, equipaggiata per piccole riparazioni
3|qualsiasi tipo, purché equipaggiata per piccole riparazioni',
    'allowed_values_php' => '',
    'field_name' => 'field_tipo_bici',
    'field_type' => 'text',
    'module' => 'text, optionwidgets',
  ),
  13 => 
  array (
    'widget_type' => 'date_js',
    'label' => 'Fine gita',
    'weight' => '2',
    'description' => 'Inserire solo se diversa dalla data di partenza',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '0',
    'multiple' => '0',
    'granularity' => 
    array (
      'Y' => 'Y',
      'M' => 'M',
      'D' => 'D',
    ),
    'input_format' => 'site-wide',
    'input_format_custom' => '',
    'output_format_date' => 'd/m/Y - H:i',
    'output_format_zone' => '',
    'output_format_custom' => 'd/m/Y',
    'output_format_date_long' => 'l, j F, Y - H:i',
    'output_format_zone_long' => '',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, d/m/Y - H:i',
    'output_format_zone_medium' => '',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'd/m/Y - H:i',
    'output_format_zone_short' => '',
    'output_format_custom_short' => '',
    'tz_handling' => 'gmt',
    'field_timezone' => 'Europe/Rome',
    'field_name' => 'field_fine_gita',
    'field_type' => 'date',
    'module' => 'date',
  ),
  14 => 
  array (
    'widget_type' => 'text',
    'label' => 'Servizi inclusi',
    'weight' => '2',
    'rows' => '5',
    'description' => 'L\'eventuale indicazione dei servizi accessori (es. viaggio in pullman, visite guidate, ecc.)',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '0',
    'multiple' => '0',
    'text_processing' => '1',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_servizi_inclusi',
    'field_type' => 'text',
    'module' => 'text',
  ),
  15 => 
  array (
    'widget_type' => 'text',
    'label' => 'Note aggiuntive',
    'weight' => '3',
    'rows' => '5',
    'description' => 'Ogni altra informazione utile, non inseribile in nessuno dei campi predefiniti',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '0',
    'multiple' => '0',
    'text_processing' => '1',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_note_aggiuntive',
    'field_type' => 'text',
    'module' => 'text',
  ),
  16 => 
  array (
    'widget_type' => 'date_text',
    'label' => 'Ora rientro',
    'weight' => '3',
    'description' => 'Inserire l\'ora prevista per il rientro, nel formato HH:MM',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'granularity' => 
    array (
      'Y' => 'Y',
      'M' => 'M',
      'D' => 'D',
      'H' => 'H',
      'N' => 'N',
    ),
    'input_format' => 'site-wide',
    'input_format_custom' => '',
    'output_format_date' => 'd/m/Y - H:i',
    'output_format_zone' => '',
    'output_format_custom' => 'G:i',
    'output_format_date_long' => 'l, j F, Y - H:i',
    'output_format_zone_long' => '',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, d/m/Y - H:i',
    'output_format_zone_medium' => '',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'd/m/Y - H:i',
    'output_format_zone_short' => '',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'field_timezone' => 'Europe/Rome',
    'field_name' => 'field_ora_rientro',
    'field_type' => 'date',
    'module' => 'date',
  ),
  17 => 
  array (
    'widget_type' => 'text',
    'label' => 'Scadenziario pagamenti / iscrizioni',
    'weight' => '3',
    'rows' => '1',
    'description' => 'Indicare eventuali scadenze per l\'iscrizione e/o il pagamento dell\'acconto, nonché eventuali sconti per prenotazioni precoci',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '0',
    'multiple' => '1',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_scadenziario_pagamenti',
    'field_type' => 'text',
    'module' => 'text',
  ),
  18 => 
  array (
    'widget_type' => 'options_buttons',
    'label' => 'modalità versamento',
    'weight' => '4',
    'description' => '',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '1',
    'min' => '',
    'max' => '',
    'allowed_values' => '1|In contanti all\'accompagnatore
2|Tramite c/c/p',
    'allowed_values_php' => '',
    'field_name' => 'field_modalit_versamento',
    'field_type' => 'number_integer',
    'module' => 'number, optionwidgets',
  ),
  19 => 
  array (
    'widget_type' => 'matrix',
    'label' => 'treni',
    'weight' => '4',
    'description' => 'Inserire gli orari di arrivo e partenza nel formato HH:MM',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'size' => '15',
    'label_row_1' => 'Andata',
    'label_row_2' => 'Ritorno',
    'label_row_3' => '',
    'label_row_4' => '',
    'label_row_5' => '',
    'label_row_6' => '',
    'label_row_7' => '',
    'label_row_8' => '',
    'label_row_9' => '',
    'label_row_10' => '',
    'label_column_1' => 'Staz. Partenza',
    'label_column_2' => 'Ora Partenza',
    'label_column_3' => 'Staz. Arrivo',
    'label_column_4' => 'Ora Arrivo',
    'label_column_5' => '',
    'label_column_6' => '',
    'label_column_7' => '',
    'label_column_8' => '',
    'label_column_9' => '',
    'label_column_10' => '',
    'field_name' => 'field_treni',
    'field_type' => 'matrix',
    'module' => 'matrix',
  ),
  20 => 
  array (
    'widget_type' => 'matrix',
    'label' => 'Contatti',
    'weight' => '5',
    'description' => 'Inserire i dati di uno o più accompagnatori:',
    'group' => false,
    'prefix' => '',
    'suffix' => '',
    'required' => '1',
    'multiple' => '0',
    'size' => '15',
    'label_row_1' => 'Accompagnatore/trice #1:',
    'label_row_2' => 'Accompagnatore/trice #2:',
    'label_row_3' => 'Accompagnatore/trice #3:',
    'label_row_4' => 'Accompagnatore/trice #4:',
    'label_row_5' => '',
    'label_row_6' => '',
    'label_row_7' => '',
    'label_row_8' => '',
    'label_row_9' => '',
    'label_row_10' => '',
    'label_column_1' => 'Nome / Cognome',
    'label_column_2' => 'Cellulare / Telefono',
    'label_column_3' => 'indirizzo email',
    'label_column_4' => '',
    'label_column_5' => '',
    'label_column_6' => '',
    'label_column_7' => '',
    'label_column_8' => '',
    'label_column_9' => '',
    'label_column_10' => '',
    'field_name' => 'field_contatti',
    'field_type' => 'matrix',
    'module' => 'matrix',
  ),
);
karens’s picture

I imported this into a test installation (after installing the matrix and computed field modules that are used here) and everything works fine. Try updating to the latest 5.x snapshot, run update.php, then see if your problems are fixed.

stella’s picture

I have the same / similar problem. When I try to change the group of a field in the "manage fields" tab from "No group." to anything else, I get the following error:

user warning: Duplicate entry 'route-group-journey_information-' for key 1 query: INSERT INTO node_group_fields (type_name, group_name, field_name) VALUES ('route', 'group-journey_information', '') in /var/www/drupal_5.1_20070206/html/includes/database.mysqli.inc on line 151.

The only way I can change the group of a field is by clicking on the "configure" link and updating it on that page. However, once I do that, it no longer appears in the field list on the "manage fields" tab.

Cheers,
Stella

yched’s picture

The problem in both reported issues is the '' (empty string) for the field_name value in the query. It triggers a 'duplicate key entry' for the primary key, which is an aggregate of type_name+group_name+field_name.

I really can't see why this field_name value should be empty. Hard to debug since the overview form is a complex thing that I don't fully grasp...

The issue is reported against 5.x--1.2, though. Can you upgrade to latest 5.x--1.3 and see if the problem is still there ?

fago’s picture

and please make sure that your drupal installation uses the fieldgroup module provided with CCK. Delete all other fieldgroup modules and only leave the one in the CCK folder. And each time you upgrade, don't forget to run the drupal update script!

stella’s picture

I'm now using the latest version from CVS (taken yesterday with tag DRUPAL-5) and it still happens I'm afraid.

Stella

stella’s picture

fago, I think you found the source of the problem. I had a modules/fieldgroup directory and a fieldgroup.module in my modules/cck directory. However, only one fieldgroup module was listed on my modules admin page. So I disabled the fieldgroup module and removed the modules/fieldgroup directory. The fieldgroup module still appeared in my listing, so I re-enabled it and retested and it all seems to work now. Thanks!

However, I now no longer have a "manage fields" tab (guess that was a feature of the other one). In addition, once I've added a field to a group I can't find any way re-editing the field. It no longer appears in the "manage fields" list. It does appear on the "display fields" tab, but I can't get into to it to edit the allowed values, etc.

Stella

yched’s picture

nice catch, fago :-)
For the remaining issues, you it looks like your cache table needs refreshing (though it should have been cleaned when you submitted your modules page)
Could you try one of the following ?
- re-submit your modules listing form
- or use devel.module's 'empty cache'
- or manually empty the 'cache' table in your db

stella’s picture

Never mind, I found the source of the problem. I was stupid and forgot to run update.php after sorting out the conflicting fieldgroup modules. I've run that since and can now edit my created fields and groups. Sorry about that. *head* -> *wall*

Thanks for all your help

Stella

yched’s picture

Status: Active » Fixed

Glad to hear that :-)

Anonymous’s picture

Status: Fixed » Closed (fixed)