diff options
author | Neeraj Bisht <neeraj.x.bisht@oracle.com> | 2012-10-16 23:18:48 +0530 |
---|---|---|
committer | Neeraj Bisht <neeraj.x.bisht@oracle.com> | 2012-10-16 23:18:48 +0530 |
commit | c55dd6bd4acc61181cd0737388516bbc70c8e000 (patch) | |
tree | 81f08a7682b07522f4b5942f1c292ef453830fbd /sql/item_func.h | |
parent | b10ab56da5fa17fa2377861594d68ccdd4b55f24 (diff) | |
download | mariadb-git-c55dd6bd4acc61181cd0737388516bbc70c8e000.tar.gz |
Bug#11745891 - LAST_INSERT(ID) DOES NOT SUPPORT BIGINT UNSIGNED
Problem:-
using last_insert_id() on an auto_incremented bigint unsigned does
not work for values which are greater than max-bigint-signed.
Analysis:-
last_insert_id() returns the first auto_incremented value for a column
and an auto_incremented value can have only positive values.
In our code, when we are initializing a last_insert_id object, we are
taking it as a signed BIGINT, So when the auto_incremented value reaches
greater than max signed bigint, last_insert_id gives negative result.
Solution:
When we are fetching the value from last_insert_id, We are setting the
unsigned_flag, so that it take only unsigned BIGINT value.
Diffstat (limited to 'sql/item_func.h')
-rw-r--r-- | sql/item_func.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item_func.h b/sql/item_func.h index de1338b4081..ec410ed3d3d 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1043,6 +1043,7 @@ public: const char *func_name() const { return "last_insert_id"; } void fix_length_and_dec() { + unsigned_flag= TRUE; if (arg_count) max_length= args[0]->max_length; } |