Note that Calcite's default parser only parses SQL in Calcite's
dialect (with a little leeway such as choice of quoting characters).

To parse other dialects, use the Babel parser. It can handle (or could
handle) SQL extensions that are not in standard SQL and which we don't
want to bring into Calcite SQL. PostgreSQL's "::" cast operator is an
example of that.

On Thu, Feb 13, 2020 at 4:00 AM Danny Chan <yuzhao....@gmail.com> wrote:
>
> If you want to parse the sql in PostgreSQL dialect, there is no way to do
> that now. You need a new SqlConformance actually.
>
> Shivraj Singh <shivraj.si...@knoldus.com>于2020年2月13日 周四下午3:50写道:
>
> > Hi, I want to parse the query of PostgreSQL via Calcite and while I am
> > parsing the query using the calcite parser it gives me exception for system
> > keyword.
> >
> > This is the program:
> > This is the query :
> > " select system from my_table;"
> >
> > val  parser:SqlParser = SqlParser.create(query)
> > parser.parseQuery()
> >
> > Exception I got.
> > org.apache.calcite.sql.parser.SqlParseException: Encountered "*system*" at
> > line 1, column 8.
> > Was expecting one of:
> >     "ABS" ...
> >     "ALL" ...
> >
> > And I also got exception for this scenario to :
> > query :
> > INSERT INTO my_table(id,system_state)
> >  VALUES (?, ?::system_state_type)
> >
> > exception I got:
> > org.apache.calcite.sql.parser.SqlParseException: Encountered "*:*" at line.
> > Was expecting one of:
> >     <EOF>
> >     "EXCEPT" ...
> >
> > Please help me
> > 1. How to parse these queries?
> > 2. Can we parse query using  PostgresqlSqlDialect, if yes then how.
> >
> > Thanks.
> >
> > *Shivraj Singh*
> > Software Consultant
> > Knoldus Inc. <http://www.knoldus.com>
> > +91-8800782123
> > Canada - USA - India - Singapore
> > <https://in.linkedin.com/company/knoldus> <https://twitter.com/Knolspeak>
> > <https://www.facebook.com/KnoldusSoftware/> <https://blog.knoldus.com/>
> >

Reply via email to