Download & Extend

system_update_7003() fails for IPv6 addresses

Project:Drupal core
Version:7.10
Component:database update system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi!

Just wanted to upgrade my blog from 6.x to 7.10 and discovered an upgrade problem. I got this error:

ERROR: value too long for type character varying(32): INSERT INTO blocked_ips (ip)
            VALUES (:db_insert_placeholder_0); Array ( ) in system_update_7003()

Looking up the database I discovered that there's an IPv6 address in access table, which is 34 chars long:

aid |               mask                | type | status
-----+-----------------------------------+------+--------
   2 | 174.122.223.85                    | host |      0
   3 | 207.191.229.196                   | host |      0
   4 | 67.159.44.24                      | host |      0
   5 | 96.30.41.140                      | host |      0
   6 | 173.233.72.34                     | host |      0
   7 | 206.51.226.198                    | host |      0
   8 | 87.98.216.47                      | host |      0
   9 | 2a02:748:8000:1:21a:8cff:fe21:5dc | host |      0
  10 | 91.201.66.6                       | host |      0

echo 2a02:748:8000:1:21a:8cff:fe21:5dc | wc
      1       1      34

So, type character varying(32) seems way too short for IPv6 addresses, which tend to be longer than IPv4 (see http://en.wikipedia.org/wiki/Ipv6 for details).

Regards,
Ingo

Comments

#1

Table blocked_ips is created in system_update_7002() with 32 chars for the IP address (in system.install)

system_update_7051() makes it 40 chars long

#2

But what happens on a fresh upgrade? Would it be that 7003 will be executed first and fails before 7051 will fix this issue?