Code: Select all
SQL ERROR [ postgres ]
ERROR: value too long for type character varying(4000) []
SQL
INSERT INTO notifications (item_id, notification_type_id, item_parent_id, notification_time, notification_read, notification_data, user_id) VALUES (184639, 14, 1, 1458606017, 0, 'a:5:{s:17:"disapprove_reason";
... , 490)
The problem is due to a limitation in the notifications table, column 'notification_data'. In phpbb/db/migration/data/v310/notifications.php,
Code: Select all
$this->table_prefix . 'notifications' => array(
'COLUMNS' => array(
'notification_id' => array('UINT', null, 'auto_increment'),
'item_type' => array('VCHAR:255', ''),
'item_id' => array('UINT', 0),
'item_parent_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'notification_read' => array('BOOL', 0),
'notification_time' => array('TIMESTAMP', 1),
'notification_data' => array('TEXT_UNI', ''),
'notification_data'
is defined as array('TEXT_UNI', '')
. The postgres limit is defined in phpbb/db/tools.php:Code: Select all
'postgres' => array(
...
'TEXT' => 'varchar(8000)',
'MTEXT' => 'TEXT',
...
'TEXT_UNI' => 'varchar(4000)',
'MTEXT_UNI' => 'TEXT',
... ),
'TEXT_UNI'
should be changed from 'varchar(4000)'
to 'varchar(8000)'
. The columns are set during the install / upgrade process, and I don't know how to test this. However, I have manually modified the database and can confirm this will fix the problem.I had a similar problem with the Board Rules extension: PostgreSQL error: value too long for type character varying - Board Rules VSE fixed the problem by modifying the rule message to point to
MTEXT_UNI
, which has a limit of 8000 characters. (github commit)Changing a database limit is not trivial. I do not want to make a change that (1) I don't know how to properly test and (2) will impact all functions that use
'TEXT_UNI'
.Can someone please provide guidance?