GreptimeTeam / greptimedb

An open-source, cloud-native, unified time series database for metrics, logs and events with SQL/PromQL supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
4.19k stars 299 forks source link

Maybe can't read tables containing uppercase letters sent from prometheus #4383

Closed NiwakaDev closed 1 month ago

NiwakaDev commented 1 month ago

What type of bug is this?

Incorrect result

What subsystems are affected?

Standalone mode (Maybe both mode)

Minimal reproduce step

  1. Run prometheus.
  2. Run node exporter.
  3. Run greptimedb. (I tried only standalone, but I think the issue also happens in distributed mode)

What did you expect to see?

When reading all tables sent from the prometheus, every query should work, like this:

select * from node_netstat_Tcp_InSegs;

What did you see instead?

error: ERROR 1146 (42S02): (TableNotFound): Failed to plan SQL: Table not found: greptime.public.node_netstat_tcp_insegs

It seems like tables sent from Prometheus aren't created as lowercase, while we can read those created from others, like MySQL client.

This is because those from others are created in lowercase, I guess.

What operating system did you use?

Maybe Any OS

What version of GreptimeDB did you use?

latest commit(e39f49fe567be8e7cb41c8541bcdfbf206af5c8f)

Relevant log output and stack trace

No response

NiwakaDev commented 1 month ago

By the way, we can read a lowercase table like so:

select * from node_time_seconds;

Am I missing something? If not, I'd like to work on this issue.

killme2008 commented 1 month ago

The MySQL client or Postgres?

You need to quote the identifier if it encounters special characters or uppercase letters.

for pg:

select * from "node_netstat_Tcp_InSegs";

for MySQL:

select * from `node_netstat_Tcp_InSegs`

https://docs.greptime.com/reference/sql/compatibility#ansi-compatibility

tisonkun commented 1 month ago

Closed as answered. Actually I hit the same problem just yesterday, it's not quite obvious that SQL identifier literal is "case-insensitive".

NiwakaDev commented 1 month ago

@killme2008 @tisonkun Thanks!