Search code examples
time-seriestdengine

question about creating upper case database name or table name in TDengine database


In TDengine shell, any upper case letter is automatically converted to a lower case letter like below:

taos> create database TEST;
Query OK, 0 of 0 row(s) in database (0.002404s)

taos> show databases;
              name              |      created_time       |   ntables   |   vgroups   | replica | quorum |  days  |           keep           |  cache(MB)  |   blocks    |   minrows   |   maxrows   | wallevel |    fsync    | comp | cachelast | precision | update |   status   |
====================================================================================================================================================================================================================================================================================
 test                           | 2021-11-16 16:07:47.410 |           0 |           0 |       1 |      1 |     10 | 3650                     |          16 |           6 |         100 |        4096 |        1 |        3000 |    2 |         0 | ms        |      0 | ready      |
 db                             | 2021-11-16 13:30:46.858 |          13 |           1 |       1 |      1 |     10 | 3650                     |          16 |           6 |         100 |        4096 |        1 |        3000 |    2 |         0 | ms        |      0 | ready      |
Query OK, 2 row(s) in set (0.001591s)

taos> use test;
Database changed.

taos> create table STB(ts timestamp, c1 int) tags(t1 int);
Query OK, 0 of 0 row(s) in database (0.002349s)

taos> show stables;
              name              |      created_time       | columns |  tags  |   tables    |
============================================================================================
 stb                            | 2021-11-16 16:08:34.322 |       2 |      1 |           0 |
Query OK, 1 row(s) in set (0.001501s)

Is there any way to create a database name or table name in upper case letters?


Solution

  • upper case database name is not supported in TDengine database, but upper case table name is supported by use following SQL:

    taos> create table `UPPER_CASE_TABLE_NAME` (ts timestamp, c1 int);                                                                                                                                                                            Query OK, 0 of 0 row(s) in database (0.008671s)
    
    taos> show tables;
               table_name           |      created_time       | columns |          stable_name           |          uid          |     tid     |    vgId     |
    ==========================================================================================================================================================
     UPPER_CASE_TABLE_NAME          | 2022-05-05 18:40:21.011 |       2 |                                |     40813871670686384 |           2 |         145 |
    Query OK, 1 row(s) in set (0.007461s)