Bug #39386 | INET_ATON() does not work properly inside a trigger | ||
---|---|---|---|
Submitted: | 11 Sep 2008 9:21 | Modified: | 12 Sep 2008 5:59 |
Reporter: | Ernie Souhrada | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S3 (Non-critical) |
Version: | 5.0.67, 5.1 | OS: | Linux (CentOS 5.2, FreeBSD) |
Assigned to: | CPU Architecture: | Any | |
Tags: | inet_aton, triggers |
[11 Sep 2008 9:21]
Ernie Souhrada
[11 Sep 2008 10:32]
Susanne Ebrecht
Verfied by using 5.1 bzr tree. This has nothing to do with the storage engine. Here my test: create table test_it ( ip_address INT UNSIGNED NOT NULL ); delimiter | create trigger test_bi BEFORE INSERT on test_it FOR EACH ROW BEGIN SET NEW.ip_address = INET_ATON(NEW.ip_address); END;| delimiter ; select inet_aton('192.168.1.1'); +--------------------------+ | inet_aton('192.168.1.1') | +--------------------------+ | 3232235777 | +--------------------------+ insert into test_it (ip_address) values ('192.168.1.1'); ERROR 1048 (23000): Column 'ip_address' cannot be null insert into test_it(ip_address) values('1.2.3.4'); Query OK, 1 row affected, 1 warning (0.01 sec) show warnings; +---------+------+-------------------------------------------------+ | Level | Code | Message | +---------+------+-------------------------------------------------+ | Warning | 1265 | Data truncated for column 'ip_address' at row 1 | +---------+------+-------------------------------------------------+ select * from test_it; +------------+ | ip_address | +------------+ | 12 | +------------+ select inet_aton('1.2.3.4'); +----------------------+ | inet_aton('1.2.3.4') | +----------------------+ | 16909060 | +----------------------+