[ZBX-7687] Using camel-case aliases in queries with PosgreSQL Created: 2014 Jan 22  Updated: 2017 May 30  Resolved: 2014 Jan 22

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Frontend (F)
Affects Version/s: 2.2.2rc1
Fix Version/s: 2.2.2rc1

Type: Incident report Priority: Major
Reporter: Pavels Jelisejevs (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: api, frontend, postgresql, sql
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

There are some places in the frontend where we use camelCase aliases for columns in an SQL query, but PostgreSQL always returns results with lower-case keys. One of the problems it causes is that a template.get request in 2.2 returns unnecessary data:

{
"output": "refer",
"parentTemplateids": 10050,
"limit": 1
}
{
    "jsonrpc": "2.0",
    "result": [
        {
            "parenttemplateid": "10050",
            "templateid": "10001"
        }
    ],
    "id": 1
}

It may cause other problems too. We'll need to check all usages of aliases in the frontend and convert them to lower case. As far as I understood, the C side uses only lower-case aliases, so it shouldn't have any problems.



 Comments   
Comment by Pavels Jelisejevs (Inactive) [ 2014 Jan 22 ]

I've added it to the coding guidelines https://www.zabbix.org/wiki/SQL_coding_guidelines

Comment by Pavels Jelisejevs (Inactive) [ 2014 Jan 22 ]

Turned out that there are only two cases of camel case usage and one of them is a regression from ZBX-7660.

Fixed directly in 2.2.2rc1 r41765.

Comment by Eduards Samersovs (Inactive) [ 2014 Jan 22 ]

Tested

Comment by Pavels Jelisejevs (Inactive) [ 2014 Jan 23 ]

CLOSED.

Generated at Thu Apr 18 10:25:23 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.