Download & Extend

Add support to sqlite for char:normal type

Project:Drupal core
Version:8.x-dev
Component:sqlite database
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:needs backport to D7

Issue Summary

Problem/Motivation

The schema API documentation lists "char:normal" as an available data type. However, this data type is currently not supported for sqlite, so schemas using this data type will not be installed properly.

Proposed resolution

Map char:normal to the SQLite CHAR data type. #1177284-3: Add support to sqlite for char:normal type implements this fix.

Remaining tasks

Once patch is committed, update http://drupal.org/node/159605 to indicate the type is now supported. (It was changed to "unsupported" after this issue was reported.)

User interface changes

None.

API changes

None.

Original report by @Bobík

After enable the module you can see this messages:

Notice: Undefined index: char:normal ve funkci DatabaseSchema_sqlite->processField() (řádek: 127 v souboru /Users/Bobik/Sites/drupal-7/includes/database/sqlite/schema.inc).
Notice: Undefined index: char:normal ve funkci DatabaseSchema_sqlite->processField() (řádek: 127 v souboru /Users/Bobik/Sites/drupal-7/includes/database/sqlite/schema.inc).
Notice: Undefined index: char:normal ve funkci DatabaseSchema_sqlite->processField() (řádek: 127 v souboru /Users/Bobik/Sites/drupal-7/includes/database/sqlite/schema.inc).
Notice: Undefined index: char:normal ve funkci DatabaseSchema_sqlite->processField() (řádek: 127 v souboru /Users/Bobik/Sites/drupal-7/includes/database/sqlite/schema.inc).

Comments

#1

+ (seeing a similar thing with ubercart's uc_store schema.)

#2

Title:Notices after install» Add support to sqlite for char:normal type
Project:OAuth» Drupal core
Version:7.x-3.x-dev» 8.x-dev
Component:Code» sqlite database

Data Types documents the availability of a char:normal type. DatabaseSchema_sqlite::getFieldTypeMap() does not yet support this in drupal7 nor drupal8.

Both the modules OAuth (_oauth_common_consumer_schema()) and ubercart's uc_store module (uc_store_schema()) make use of char:normal.

Errors from uc_store's uc_store_schema():

Notice: Undefined index: char:normal in DatabaseSchema_sqlite->processField() (line 122 of /var/www/localhost/htdocs/drupal/includes/database/sqlite/schema.inc).
Notice: Undefined index: char:normal in DatabaseSchema_sqlite->processField() (line 122 of /var/www/localhost/htdocs/drupal/includes/database/sqlite/schema.inc).
PDOException: SQLSTATE[HY000]: General error: 1 near "(": syntax error: CREATE TABLE {uc_countries} ( country_id INTEGER NOT NULL CHECK (country_id>= 0), country_name VARCHAR(255) NOT NULL DEFAULT '', country_iso_code_2 (2) NOT NULL DEFAULT '', country_iso_code_3 (3) NOT NULL DEFAULT '', version INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (country_id) ); ; Array ( ) in db_create_table() (line 2592 of /var/www/localhost/htdocs/drupal/includes/database/database.inc)

I believe that mapping this type onto 'CHAR' makes the most sense and will add a patch which does that. This bug affects both drupal-8.x and drupal-7.x.

#3

This patch seems to fix the issue for me and makes uc_store (from ubercart) more functional on sqlite.

AttachmentSizeStatusTest resultOperations
drupal-1177284.patch1012 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 32,223 pass(es).View details

#4

Status:active» needs review

#5

Status:needs review» reviewed & tested by the community
Issue tags:+needs backport to D7

#3 fixes the errors in uc_store for me too.

#6

Issue tags:-sqlite

+1 from me.

#7

Added summary.

#8

Status:reviewed & tested by the community» fixed

Committed and pushed to 8.x and 7.x! Thanks!

#9

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here