From #373763: field_sql_storage_schema() does not remove the field_config_entity_type table I have discovered that attempting to do a clean install of HEAD on PostgreSQL is absolutely broken. The installer stops with an error "Fatal error: Call to undefined function field_read_fields() in /home/davereid/Projects/drupal-head/modules/field/modules/field_sql_storage/field_sql_storage.install on line 47"

We need to fix it in http://api.drupal.org/api/function/field_sql_storage_schema/7 with either:
module_load_include('inc', 'field', 'field.crud');
or
if (db_table_exists('field_config') && drupal_function_exists('field_read_fields')) {

Also, should we check if db_table_exists('field_config') or module_exists('field')? Does it really matter?

Comments

dave reid’s picture

Priority: Normal » Critical
bjaspan’s picture

I think that error means that field.module is not loaded when field_sql_module.install is being installed. Not quite sure why that would happen with pgsql but not mysql.

josh waihi’s picture

Status: Active » Needs review
Issue tags: +PostgreSQL Surge
Call Stack:
0.0047 410840 1. {main}() /home/josh/projects/drupal7/install.php:0
0.0077 653732 2. install_main() /home/josh/projects/drupal7/install.php:1185
0.2162 7072584 3. install_tasks() /home/josh/projects/drupal7/install.php:159
0.2434 7641604 4. drupal_bootstrap() /home/josh/projects/drupal7/install.php:627
0.2475 7653412 5. _drupal_bootstrap() /home/josh/projects/drupal7/includes/bootstrap.inc:1101
0.2476 7653412 6. variable_init() /home/josh/projects/drupal7/includes/bootstrap.inc:1180
0.2509 7656704 7. cache_set() /home/josh/projects/drupal7/includes/bootstrap.inc:614
0.2586 7665760 8. MergeQuery->execute() /home/josh/projects/drupal7/includes/cache.inc:126
0.2619 7677304 9. InsertQuery_pgsql->execute() /home/josh/projects/drupal7/includes/database/query.inc:691
0.2619 7677536 10. drupal_get_schema() /home/josh/projects/drupal7/includes/database/pgsql/query.inc:29
0.2691 7913744 11. module_invoke() /home/josh/projects/drupal7/includes/bootstrap.inc:1420
0.2691 7913744 12. call_user_func_array() /home/josh/projects/drupal7/includes/module.inc:492
0.2691 7913744 13. field_sql_storage_schema() /home/josh/projects/drupal7/includes/module.inc:0

See above, Drupal isn't actually trying to install field_sql_storage at all but merely run #3: install_tasks() - however the insert query used by pgsql invokes the schema api which calls field_sql_storage_schema() which calls the undefined function. This doesn't happen in MySQL because MySQL doesn't use the schema on insert queries.

The patch http://drupal.org/node/349671#comment-1186115 will fix this because it takes drupal_get_schema away from the driver

This needs Crell's approval.

yched’s picture

Should we mark this as a dupe then ?

catch’s picture

Status: Needs review » Closed (duplicate)

Yep.