[ZBX-3671] Use of 'count(value)' on 'NCLOB' column Created: 2011 Mar 31  Updated: 2017 May 30  Resolved: 2011 Apr 18

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 1.8.4
Fix Version/s: 1.8.6

Type: Incident report Priority: Major
Reporter: Marc Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Server: ZABBIX 1.8.4 (Oracle Call Interface)
Server Database: Oracle RDBMS 11.2.0.1
OS: CentOS release 5.5


Issue Links:
Duplicate
is duplicated by ZBX-3693 Reading from columns of 'NCLOB' data ... Closed

 Description   

Hi,

there is a bug in a SQL query:

  1. sed -n 380,385p zabbix-1.8.4/src/libs/zbxserver/evalfunc.c
    offset = zbx_snprintf(sql, sizeof(sql),
    "select count(value)"
    " from %s"
    " where itemid=" ZBX_FS_UI64,
    get_table_by_value_type(item->value_type),
    item->itemid);

Select queries with 'count(value)' won't work when column 'value' is of any kind of 'LOB' datatypes:

select count(value) from history_text where itemid=26212 and clock<=1301417122 and clock>1301417122
ORA-00932: inconsistent datatypes: expected - got NCLOB

Changing the query to 'count' would work but may result in a different result set. Adding a condition for LOB columns could be a solution.



 Comments   
Comment by Alexander Vladishev [ 2011 Apr 13 ]

Available in development branch svn://svn.zabbix.com/branches/dev/ZBX-3671

Comment by Alexander Vladishev [ 2011 Apr 18 ]

Fixed in version pre1.8.6, r19067

Comment by Marc [ 2011 Apr 18 ]

Be aware that 'count(value)' would count only datasets with 'value != NULL' and count would count all datasets.

Generated at Thu Apr 25 05:15:06 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.