MySQL UUID_SHORT data type -


i have user table. primary key user_id has datatype bigint(20).

i generate user_id using uuid_short() via trigger below. issue warning when try insert record follows:

warning: #1366 incorrect integer value: '' column 'user_id' @ row 1 

my phpmyadmin trigger follows:

begin set new.user_id=uuid_short(); end 

any reason why getting warning? have set datatype correctly?

int four-byte signed integer, while uuid_short() returns 64-bit (i.e. 8 byte) unsigned integer. trying store 64-bit data type 4-byte int , mysql appears storing empty string '' field user_id.

from mysql manual:

uuid_short()

returns “short” universal identifier 64-bit unsigned integer (rather string-form 128-bit identifier returned uuid() function).

you should use bigint unsigned type instead.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -