Skip to content

Could not parse complex COALESCE/CAST #1607

Closed
@d2a-raudenaerde

Description

@d2a-raudenaerde

This bit of (Postgresql valid) SQL fails:

select
t0.*
,	cr.code
from
mytable t0
join 	othertable cr ON cr.code = '1234'
where	
   COALESCE (cast(to_date(to_char(t0.datum_ontslagen,'YYYYMMDD'),'YYYYMMDD')||' '||t0.tijd_ontslagen as timestamp), current_timestamp(0)) - 
      cast(to_date(to_char(t0.datum_opname,'YYYYMMDD'),'YYYYMMDD')||' '||t0.tijd_opname as timestamp)
   >= (SELECT somefunction()) * interval '1 hours' 


net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "("
at line 8, column 13.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions