TDengine icon indicating copy to clipboard operation
TDengine copied to clipboard

sql statement flaw

Open freemine opened this issue 3 years ago • 0 comments

Bug Description as titled as above

To Reproduce Steps to reproduce the behavior:

Welcome to the TDengine Command Line Interface, Client Version:3.0.1.5
Copyright (c) 2022 by TDengine, all rights reserved.

   ******************************  Tab Completion  **********************************
   *   The TDengine CLI supports tab completion for a variety of items,             *
   *   including database names, table names, function names and keywords.          *
   *   The full list of shortcut keys is as follows:                                *
   *    [ TAB ]        ......  complete the current word                            *
   *                   ......  if used on a blank line, display all valid commands  *
   *    [ Ctrl + A ]   ......  move cursor to the st[A]rt of the line               *
   *    [ Ctrl + E ]   ......  move cursor to the [E]nd of the line                 *
   *    [ Ctrl + W ]   ......  move cursor to the middle of the line                *
   *    [ Ctrl + L ]   ......  clear the entire screen                              *
   *    [ Ctrl + K ]   ......  clear the screen after the cursor                    *
   *    [ Ctrl + U ]   ......  clear the screen before the cursor                   *
   **********************************************************************************

Server is Community Edition.

taos> select 'a' as foo;
 foo |
======
 a   |
Query OK, 1 row(s) in set (0.000287s)
### this is as expected

taos> select 'a' as foo where foo = 'bcd';
 foo |
======
 a   |
Query OK, 1 row(s) in set (0.000255s)
### this is not as expected, cause where-clause does not effect

taos> select * from (select table_name as name, 'foo' as non_exist from information_schema.ins_tables limit 1) where non_exist = 'foo';
              name              | non_exist |
=============================================
 suzhou                         | foo       |
Query OK, 1 row(s) in set (0.004968s)
### this is as expected

~~taos> select table_name as name, 'foo' as non_exist from information_schema.ins_tables where non_exist = 'foo';~~ ~~DB error: Invalid column name: non_exist (0.004324s)~~ ~~this is just weird~~

~~taos> select table_name as name from information_schema.ins_tables where name = 'foo';~~ ~~DB error: Invalid column name: name (0.003182s)~~ ~~this is just weird~~

freemine avatar Nov 03 '22 07:11 freemine