Field API field_schema for text field error I've built a custom field using the Field API. I've defined the following element:
  $element['tabcontent'] = array(
    '#title' =&gt; t('Tab content'),
    '#type' =&gt; 'text_format',
    '#required' =&gt; $required,
    // use #default_value to prepopulate the element
    // with the current saved value
    '#default_value' =&gt; isset($item['tabcontent']) ? $item['tabcontent'] : '',
    '#tree' =&gt; true,
    '#rows' =&gt; 10,
    '#format' =&gt; 'full_html',
    '#base_type' =&gt; 'textarea',
  );

I've got the following code in the install file:
function tabfield_field_schema($field) 
{
 
  $columns = array(
    'tabtitle' =&gt; array('type' =&gt; 'varchar', 'length' =&gt; 255, 'not null' =&gt; TRUE),
    'tabcontent' =&gt; array('type' =&gt; 'text','not null' =&gt; TRUE,'size' =&gt; 'normal','description' =&gt; 'Question prompt','length' =&gt; '1000'  ),
  );


  return array(
    'columns' =&gt; $columns,
    'indexes' =&gt; array(),
  );
}

However, I get the following error when saving a new node:

Warning: preg_match_all() expects parameter 2 to be string, array
given in _media_generate_tagMap() (line 186 of
C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).
Warning: Invalid argument supplied for foreach() in
_media_generate_tagMap() (line 187 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).
Warning: htmlspecialchars() expects parameter 1 to be string, array
given in check_plain() (line 1572 of
C:\Workspace\RnD\drupal1\includes\bootstrap.inc).
PDOException:
SQLSTATE[21S01]: Insert value list does not match column list: 1136
Column count doesn't match value count at row 1: INSERT INTO
{field_data_field_tab} (entity_type, entity_id, revision_id, bundle,
delta, language, field_tab_tabtitle, field_tab_tabcontent) VALUES
(:db_insert_placeholder_0, :db_insert_placeholder_1,
:db_insert_placeholder_2, :db_insert_placeholder_3,
:db_insert_placeholder_4, :db_insert_placeholder_5,
:db_insert_placeholder_6, :db_insert_placeholder_7_value,
:db_insert_placeholder_7_format); Array ( [:db_insert_placeholder_0]
=&gt; node [:db_insert_placeholder_1] =&gt; 17 [:db_insert_placeholder_2] =&gt; 17 [:db_insert_placeholder_3] =&gt; tabbed_page
[:db_insert_placeholder_4] =&gt; 0 [:db_insert_placeholder_5] =&gt; und
[:db_insert_placeholder_6] =&gt; ss [:db_insert_placeholder_7_value] =&gt;
ss [:db_insert_placeholder_7_format] =&gt; full_html ) in
field_sql_storage_field_storage_write() (line 448 of
C:\Workspace\RnD\drupal1\modules\field\modules\field_sql_storage\field_sql_storage.module).
This is because your value suppose to be string, however you given array as per these errors:

Warning: preg_match_all() expects parameter 2 to be string, array given in _media_generate_tagMap()
Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain()

Since you're sending array, the column count doesn't match in your SQL query.
This is what you're sending:
INSERT INTO {field_data_field_tab} (entity_type, entity_id, revision_id, bundle, delta, language, field_tab_tabtitle, field_tab_tabcontent)
VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7_value, :db_insert_placeholder_7_format);
Array ( [:db_insert_placeholder_0] =&gt; node [:db_insert_placeholder_1] =&gt; 17 [:db_insert_placeholder_2] =&gt; 17 [:db_insert_placeholder_3] =&gt; tabbed_page [:db_insert_placeholder_4] =&gt; 0 [:db_insert_placeholder_5] =&gt; und [:db_insert_placeholder_6] =&gt; ss [:db_insert_placeholder_7_value] =&gt; ss [:db_insert_placeholder_7_format] =&gt; full_html )

which can be broke down into:

Fields: entity_type, entity_id, revision_id, bundle, delta, language, field_tab_tabtitle, field_tab_tabcontent
Placeholders: :db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7_value, :db_insert_placeholder_7_format

So you've 8 fields, but 9 placeholders.
Fix
To fix it, you've to check passed value of $item['tabcontent'] and make it a string. For example:
'#default_value' =&gt; !empty($item['tabcontent']['value']) ? $item['tabcontent']['value'] : '',


See also:

Errors when using a field of '#type' =&gt; 'text_format'