shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Support get detail error info for parse

Open tuichenchuxin opened this issue 2 years ago • 4 comments

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;
    }

tuichenchuxin avatar Jul 08 '22 02:07 tuichenchuxin

Hi, can I try this?

chakkk309 avatar Jul 08 '22 02:07 chakkk309

sure

tuichenchuxin avatar Jul 08 '22 03:07 tuichenchuxin

@chakkk309 hi, is there any progress for this issue?

tuichenchuxin avatar Aug 05 '22 02:08 tuichenchuxin

@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.

chakkk309 avatar Aug 05 '22 04:08 chakkk309

Hello , this issue has not received a reply for several days. This issue is supposed to be closed.

github-actions[bot] avatar Oct 08 '22 16:10 github-actions[bot]

this problem still need to be fixed?

hailin0 avatar Apr 23 '23 15:04 hailin0

You can do some test, I think it has been support by other contributor.

strongduanmu avatar Apr 24 '23 00:04 strongduanmu

You can do some test, I think it has been support by other contributor.

I have tested and found no such issue

hailin0 avatar Apr 24 '23 02:04 hailin0