SQL::Translator::Parser::Oracle fails to parse DROP statement
jgrg opened this issue · comments
On line 137 of SQL::Translator::Parser::Oracle, the grammar rule:
drop : /drop/i WORD(s) NAME WORD(s?) ';'
fails to match if table names aren't surrounded with quotes because WORD(s)
matches to the end and NAME
has nothing left to match.
I just happened upon this problem. I boiled it down to this reproduction:
$ echo "drop table foo;" |sqlt -f Oracle -t SQLite
ERROR (line 1): Invalid statement: Was expecting remark, or run, or
prompt, or create, or table comment, or comment on
table, or comment on column, or alter, or drop
Error: translate: Error with parser 'SQL::Translator::Parser::Oracle': Parse failed.
Replace "Oracle" with "SQLite" and it works.
Changing WORD(s) to WORD in the line noted previously made it work, though I'm not sure that's the correct solution.