postgres sql syntax error
kpcyrd opened this issue · comments
I've just launched the docker container and tried the following:
mig> create action
Entering action launcher with empty template
Type exit or press ctrl+d to leave. help may help.
launcher> listagents
EvaluateAgentTarget() -> GetAPIResource() -> error: HTTP 500 Internal Server Error. No response body.
launcher>
The following error has been logged on the api:
2017/08/22 14:32:58 8922969210884 - - [error] Error while preparing search statement: 'pq: syntax error at or near "GROUP"' in 'SELECT agents.id, agents.name, agents.queueloc, agents.mode,
agents.version, agents.pid, agents.starttime, agents.destructiontime,
agents.heartbeattime, agents.status, agents.tags, agents.environment FROM agents WHERE GROUP BY agents.id
ORDER BY agents.heartbeattime DESC LIMIT $1 OFFSET $2;'
It seems this is expecting conditions which are missing.
It seems I fell through all ifs, leaving where
an empty string, which is not expected to be possible:
Lines 643 to 645 in cec9fc8
I was able to reproduce this, it's occurring because a target has not been set.
If you have an agent connected, can you try:
settarget status='online'
listagents
We should add some sort of error here indicating the target has not been set rather than attempt the query without it.
@ameihm0912 thanks for the quick response. After setting a filter with settarget status='online'
the command finished without an error. :)