I am using the ISBN module on my site which is using PostgreSQL as the database back end. I have configured a content type using 13-digit ISBN's and when saving to the database I get an error that the data is too long to fit into the column. The error I received from Drupal is as follows:

Query failed: ERROR: value too long for type character varying(16) in /usr/local/www/drupal6/includes/database.pgsql.inc on line 139.

The node was essentially destroyed but I can retrieve it from its previous revisions so its not a complete loss.

I manually changed the table containing the ISBN to 17 characters long and the problem is resolved. The statement I used is:

alter table content_type_book_review alter column field_isbn_value type varchar(17);

A quick look at the module code indicates that line 102 needs to be changed so that the length is 17 bytes rather than 16.

case 'database columns':
$columns['value'] = array('type' => 'varchar', 'length' => 17, 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE);
return $columns;

Comments

jon pugh’s picture

Status: Active » Fixed

Committed, thanks for the testing.

new release pending.

Status: Fixed » Closed (fixed)

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