sql-parser
sql-parser copied to clipboard
error
CREATE TABLE students ( name TEXT, student_number INTEGER, city TEXT,grade DOUBLE, credits BIGINT )
Can you provide some details of the error you get? Currently, I am able to parse the statement successfully.
@dey4ss like this Sql is : CREATE TABLE XIAOZHAO.table1 (column1 CHAR(11),column2 VARCHAR(100),column3 VARCHAR(100));
Result is : Given string is not a valid SQL query. syntax error, unexpected TABLE, expecting SELECT or '(' (L0:0)
Does your system use Windows-style line feeds (\r\n
instead of \n
)? This could be a problem, since we explicitly only allow space, tab, and linefeed (not carriage return) as whitespace in the lexer: https://github.com/hyrise/sql-parser/blob/5a5fd248496e8d415fd2a4b1787e7114d90e60de/src/parser/flex_lexer.l#L63
@dey4ss My system use Linux is \n
@dey4ss Will there be other effects if I change it to the following? [ \t\n]+ /* skip whitespace */ {yymore()};
Unfortunately, I won't be able to look into this in the next three to four days. In the meanwhile, could you please also let us know how you invoke the parser (e.g., CLI, inside your code, ...) with a minimal example/snippet and provide some more information about your setup.
Will there be other effects if I change it to the following? [ \t\n]+ /* skip whitespace */ {yymore()};
Sorry, I cannot answer this right away but will come back on that in a couple of days. From what I quickly found (no guarantees) here:
yymore
will cause the next token'syytext
to include the currentyytext
it should mess up the tokenization since the whitespaces are included in every following token.