#support

Troubleshooting ILIKE Query Error

TLDR Romario is having trouble using ILIKE with a variable in a query. Srikanth suggests checking the quotes, but the issue remains unresolved.

Powered by Struct AI
May 10, 2023 (7 months ago)
Romario
Photo of md5-6c7925cd4df7e39b036d2b26fb21013d
Romario
07:41 PM
How can I use ILIKE? I have this, but it fails
      AND stringTagMap['service.name'] ilike '%{{.environment}}'

07:42
Romario
07:42 PM
Using the variable is not working properly. If I use %production the query works
May 11, 2023 (7 months ago)
Srikanth
Photo of md5-ce04a9988e2fd758a659dc55be6f2543
Srikanth
01:55 AM
I don’t think you need single quotes around. What error does it show?
Romario
Photo of md5-6c7925cd4df7e39b036d2b26fb21013d
Romario
07:58 PM
400 error
07:59
Romario
07:59 PM
Without quotes AND stringTagMap['service.name'] ilike %{{.environment}}
Error: API responded with 400 - encountered multiple errors: error in query-A: code: 62, message: Syntax error: failed at position 394 ('%') (line 8, col 46): %<no value> GROUP BY op_name, interval ORDER BY op_name ASC, interval. Expected one of: ANY, ALL, BETWEEN expression, string concatenation expression, list, delimited by operator of variable arity, additive expression, list, delimited by binary operators, INTERVAL operator expression, INTERVAL, TIMESTAMP operator expression, TIMESTAMP, DATE operator expression, DATE, multiplicative expression, unary expression, expression with prefix unary operator, NOT, CAST expression, tuple element expression, array element expression, element of expression, SELECT subquery, CAST operator, tuple, collection of literals, parenthesized expression, array, literal, NULL, number, Bool, true, false, string literal, case, CASE, COLUMNS matcher, COLUMNS, function, identifier, qualified asterisk, compound identifier, list of elements, asterisk, substitution, MySQL-style global variable
08:00
Romario
08:00 PM
With quotes AND stringTagMap['service.name'] ilike '%{{.environment}}'
Error: API responded with 400 - encountered multiple errors: error in query-A: code: 62, message: Syntax error: failed at position 397 ('production') (line 8, col 49): production'' GROUP BY op_name, interval ORDER BY op_name ASC, interval. Expected one of: token, DoubleColon, MOD, DIV, NOT, BETWEEN, LIKE, ILIKE, NOT LIKE, NOT ILIKE, IN, NOT IN, GLOBAL IN, GLOBAL NOT IN, IS, AND, OR, QuestionMark, alias, AS, GROUP BY, WITH, HAVING, WINDOW, ORDER BY, LIMIT, OFFSET, SETTINGS, UNION, EXCEPT, INTERSECT, INTO OUTFILE, FORMAT, end of query
May 15, 2023 (7 months ago)
Romario
Photo of md5-6c7925cd4df7e39b036d2b26fb21013d
Romario
06:52 PM
Srikanth 👀
May 16, 2023 (7 months ago)
Srikanth
Photo of md5-ce04a9988e2fd758a659dc55be6f2543
Srikanth
07:37 AM
Can you share the full query?