JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

implicit cast to "double precision" is not supported

Open sixinli opened this issue 2 years ago • 5 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. SELECT double precision '1'
  2. Parsing this SQL using JSqlParser with this statements
  3. org.junit.ComparisonFailure: Expected query to parse but it failed to parse (error: Encountered unexpected token: "\'1\'" <S_CHAR_LITERAL>

Expected behavior query to parse

System

  • postgres
  • 15
  • 4.1

sixinli avatar Sep 23 '21 16:09 sixinli

This kind of implicit cast is not supported (yet). Please consider to use a Standard Compliant explicit cast:

SELECT CAST('1' AS DOUBLE)
;

manticore-projects avatar Sep 23 '21 23:09 manticore-projects

This also seems to work:

SELECT '1'::Double
;

manticore-projects avatar Sep 23 '21 23:09 manticore-projects

thanks for the workaround, it'd be great if this can be supported in the future though :)

sixinli avatar Oct 11 '21 23:10 sixinli

double precision is definitly supported

select 1::double precision

however, this syntax double precision '1' is not.

wumpz avatar Oct 14 '21 05:10 wumpz

thanks for the note, updated the title :)

sixinli avatar Oct 14 '21 20:10 sixinli

I am closing this since it is not support and won't be supported (unless any genius provided a PR).

manticore-projects avatar Sep 06 '23 07:09 manticore-projects