shardingsphere
shardingsphere copied to clipboard
Support get detail error info for parse
Feature Request
Is your feature request related to a problem?
No
Describe the feature you would like.
parse error should have detail info. like this sql
CREATE TABLE public.files (id BIGINT NOT NULL, created_at TIMESTAMP WITHOUT TIME ZONE, updated_at TIMESTAMP WITHOUT TIME ZONE, created_by BIGINT, updated_by BIGINT, name VARCHAR(255), path VARCHAR(255), CONSTRAINT files_pkey PRIMARY KEY (id))
We can only get this error info
You have an error in your SQL syntax
Actually we can get detail info like this
line 1:184 no viable alternative at input 'path'
How to do
I found if I remove this error listener line. Then, I can get error info . So it's may be a way to get detail info.
@SneakyThrows(ReflectiveOperationException.class)
private static SQLParser createSQLParser(final TokenStream tokenStream, final Class<? extends SQLParser> parserClass) {
SQLParser result = parserClass.getConstructor(TokenStream.class).newInstance(tokenStream);
((Parser) result).setErrorHandler(new BailErrorStrategy());
// ((Parser) result).removeErrorListener(ConsoleErrorListener.INSTANCE);
return result;
}
Hi, can I try this?
sure
@chakkk309 hi, is there any progress for this issue?
@chakkk309 hi, is there any progress for this issue?
Hi, this issue is still in progress, if there is any progress I will keep you updated.
Hello , this issue has not received a reply for several days. This issue is supposed to be closed.
this problem still need to be fixed?
You can do some test, I think it has been support by other contributor.
You can do some test, I think it has been support by other contributor.
I have tested and found no such issue