[ZBX-8328] varchar(N) in IBM DB2 is limited to N bytes rather than N characters Created: 2014 Jun 10 Updated: 2017 May 30 Resolved: 2014 Nov 06 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F), Installation (I), Proxy (P), Server (S) |
Affects Version/s: | 2.2.3 |
Fix Version/s: | 2.2.8rc1, 2.4.3rc1, 2.5.0 |
Type: | Incident report | Priority: | Blocker |
Reporter: | Aleksandrs Saveljevs | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | db2, schema, utf8 | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
Description |
According to the following links, varchar(N) is indeed in bytes:
When trying to insert a value into the database that is N characters, but more than N bytes, it gives the following error: IBM DB2 ERROR: [-433] 22001 [[IBM][CLI Driver][DB2/LINUXX8664] SQL0433N Value "????????? ???????? ? UTF-8..." is too long. SQLSTATE=22001] Ideally, if we find a way, we should make it possible to store N characters. If not, we should at least cut the value we are trying to insert to N bytes so that there are no SQL errors. |
Comments |
Comment by Aleksandrs Saveljevs [ 2014 Jun 10 ] |
|
Comment by Andris Zeila [ 2014 Oct 10 ] |
Wrong issue ( |
Comment by Andris Zeila [ 2014 Oct 20 ] |
In DB2 utf-8 strings should be stored into vargraphic (<= 255 bytes) and dbclob (255+ bytes) type fields. However there are no easy way to convert existing varchar(2048) fields to dbclob(2048) type fields. We also can't convert existing varchar(2048) fields to vargraphic(2048) because of 32K row size limitations (host_inventory is at least one of tables that exceeds this limit when converted to vargraphic type fields). So for 2.2 the only real solution is to truncate the strings by bytes instead of characters when DB2 is used. |
Comment by Andris Zeila [ 2014 Oct 23 ] |
(1) [S] server related fixes are in development branch svn://svn.zabbix.com/branches/dev/ZBX-8328 asaveljevs Function zbx_db_dyn_escape_string_len() for IBM DB2 is written in such a way that it might go into infinite loop if the string to escape contains a non-UTF-8 character. REOPENED. wiper RESOLVED in r50466 asaveljevs CLOSED |
Comment by Andris Zeila [ 2014 Oct 24 ] |
(2) [F] frontend should also truncate strings by bytes when working with DB2. Also while at it check the wiper We decided to not change frontend for now. CLOSED |
Comment by Aleksandrs Saveljevs [ 2014 Nov 05 ] |
(3) Please see r50460. It suggests some stylistic fixes. wiper Thanks, CLOSED |
Comment by Andris Zeila [ 2014 Nov 06 ] |
Released in:
|
Comment by Alexander Vladishev [ 2014 Dec 19 ] |
Caused regression: |
Comment by Aleksandrs Saveljevs [ 2016 Aug 17 ] |
Another problem: |