Search code examples
tdengine

why header is different in query result with taos shell and jdbc in TDengine database


with the same query, in taos shell I got result like:

taos> select last(ts, c1) from db.stb where t0 = 'shanghai'\G;
*************************** 1.row ***************************
ts: 2020-10-01 00:00:09.999
c1: NFLxdQTArXRz88eZizveRdtcPgomSEl7XottIKO0LTKJEoKgRf2FVKp2AmYFpvtLqk311k
Query OK, 1 row(s) in set (0.006903s)

in JDBC, I got result like:

[ OK ] Connection established. [ OK ] time cost: 110 ms, execute statement ====> select last(ts, c1) from db.stb where t0 = 'shanghai' last(ts): 2020-10-01 00:00:09.999 last(c1): NFLxdQTArXRz88eZizveRdtcPgomSEl7XottIKO0LTKJEoKgRf2FVKp2AmYFpvtLqk311k connection closed.

why the header is different for same query?


Solution

  • the header name can be configured with keepColumnName in /etc/taos/taos.cfg

    # the last_row/first/last aggregator will not change the original column name in the result fields
    keepColumnName            1