TDengine icon indicating copy to clipboard operation
TDengine copied to clipboard

throw “string data overflow” error when i insert data.

Open schenton opened this issue 6 years ago • 3 comments

when i insert data with this sql below, it can success. taos> INSERT INTO seisflink.GE_BOAB__BHZ USING seismometer TAGS(GE, BOAB,-, BHZ) VALUES (1576480308495,16455) (1576480308545,16445); Query OK, 0 row(s) affected (0.000750s)

but i only modified the tags(the third tag) value "-" to "--" , there was an error . the whole sql is below. taos> INSERT INTO seisflink.GE_BOAB__BHZ USING seismometer TAGS(GE, BOAB,--, BHZ) VALUES (1576480308495,16455) (1576480308545,16445); DB error: invalid SQL: syntax error near "--, bhz) values (1576480308495,16455) (1576480308545,16445);" (string data overflow)

schenton avatar Dec 17 '19 01:12 schenton

Actually, in the pre-verison of taos, the sql i mentioned above can insert data success.

schenton avatar Dec 17 '19 01:12 schenton

In handling the string data, you should use the quoted string. Therefore, the right SQL (if all tags are in string format) may be as follows:

INSERT INTO seisflink.GE_BOAB__BHZ USING seismometer TAGS('GE', 'BOAB','--', 'BHZ') VALUES (1576480308495,16455) (1576480308545,16445);

The previous version does not apply the quote string check to the string(binary/nchar) data. But in the new version, the parsed result is UNDEFINED, when using the string without quote in SQL string.

hjxilinx avatar Dec 17 '19 06:12 hjxilinx

3q

schenton avatar Dec 18 '19 09:12 schenton