No data is returned when using keywords as conditions in the query

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 关键字作为条件时,查询不出数据

| username: Kongdom

[Test Environment for TiDB] Testing
[TiDB Version] v6.5.0
[Reproduction Path]

Using the following query does not return any data:

SELECT * FROM INFORMATION_SCHEMA.cluster_config 
WHERE TYPE = 'tikv'
AND 'KEY' = 'log-level'

image

This works

image

| username: h5n1 | Original post link

The key is the backtick, the key with the tilde.

| username: YuchongXU | Original post link

It is estimated that there are special characters or spaces.

| username: liuis | Original post link

Are there any special characters in the stored value?

| username: db_user | Original post link

This shouldn’t be a bug, right? If both sides of the key are single quotes, then it is treated as a string. key=log-level, these two are string comparisons, and the result is false, so and-ing with a false result is still false. Not finding a result is normal, right?

| username: Kongdom | Original post link

The truth is out, so that’s how it is.

| username: Kongdom | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.