Skip to main content

Hi All,

 

I am inserting data to Postgresql in mule4 project. 

 

Table structure is below:

Postgresql in mule4 project | org.postgresql.util.PSQLException: Bad value for type timestamp 

I am getting error:

org.postgresql.util.PSQLException: Bad value for type timestamp : 2022-08-09T22:25:47Z

 

%dw 2.0

output application/json

import * from dw::core::Strings

---

{

object : payload.object,

id : payload.id,

created_date : substringBefore (payload.createdDate, ".") as DateTime ,

state : payload.state

}

 

The same is working if I am using the direct sql:

 

Screenshot_4 

 

Thanks

Yatan

1 answer
  1. Aug 10, 2022, 3:17 AM

    @Yatanveer Singh​ Can you try changing the DateTime to LocalDateTime, it should work.

    %dw 2.0

    output application/json

    import * from dw::core::Strings

    ---

    {

    object : payload.object,

    id : payload.id,

    created_date : substringBefore (payload.createdDate, ".") as LocalDateTime ,

    state : payload.state

    }

0/9000