Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-14556

Disapproving posts with notification causes postgreSQL error (> 4,000 characters)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Resolved
    • 3.1.6, 3.1.8
    • None
    • Notification System
    • None
    • PostgreSQL 9.4.6 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2), 64-bit

    Description

      When a moderator disapproves a post containing more than 4,000 characters, postgreSQL triggers an error:

      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)
       
      BACKTRACE
      

      The disapproval appears in the moderator log, but no notification is sent. My board frequently disapproves posts > 4,000 characters, so this problem needs to be fixed.

      In phpbb/db/migration/data/v310/notifications.php, table notifications column 'notification_data' is assigned to array('TEXT_UNI', '').

      $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', ''),
      

      The postgres limit is defined in phpbb/db/tools.php:

      'postgres'	=> array(
      ...
      	'TEXT'		=> 'varchar(8000)',
      	'MTEXT'		=> 'TEXT',
      ...
      	'TEXT_UNI'	=> 'varchar(4000)',
      	'MTEXT_UNI'	=> 'TEXT',
      ...	),

      The database is configured during install / upgrade process, I don't know how to test this. However, I have modified the database column directly from 4000 to 8000 characters and can confirm this will fix the problem.

      Can postgres 'TEXT_UNI' be changed from varchar(4000) to varchar(8000)?

      Attachments

        Activity

          People

            Marc Marc
            Lady_G Lady_G
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: