support for negative number
Could you please provide some context for the adaptation? In most cases, negative numbers should be treated as unary minus plus unsigned integer, resulting in the correct result. Is there a scenario we are not covering yet? By solely changing the lexer rule, I'm afraid that we end up enabling negative numbers for, e.g., VARCHAR/CHARACTER VARYING.
hi, and how to represent a negative number ?
insert into persons(id, name, age, money) values (-200, 'write', -17.8, -23.45);
the sql like this is not correct .
please show me the right sql, thank you !
I could reproduce the error and opened an issue for it. We will discuss on what is the best solution for a fix.
we develop our database system base on sql-parser, and we do not know how to insert a negative number, so we edit the lexer rule. on the current situation, is there any ways to add negative numbers ?
@JoyBinY A simple fix (which is, however, not 100% correct) is changing
-insert_statement : INSERT INTO table_name opt_column_list VALUES '(' literal_list ')' {
+insert_statement : INSERT INTO table_name opt_column_list VALUES '(' expr_list ')' {
in /src/parser/bison_parser.y line 675.
Without changing the parser, you could try another insert syntax: insert into t select -1, -4, 'str' from dummy;
Otherwise, we will update the parser within the next weeks (see #213)