If I query like below we get data with oracle db with jpql.

```
public static void main(String[] args) {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("postgres");
    EntityManager entityManager = emf.createEntityManager();
    try {
        entityManager.getTransaction().begin();
        String jpqlQuery = "SELECT coalesce(c.actualDateTime, "
                + "coalesce("
                + "c.propDepDateTime+"
                + "TO_NUMBER(c.estOnDateTime-c.estOffDateTime),"
                + "c.estOnDateTime )) FROM Flight c  ";

        Query query = entityManager.createQuery(jpqlQuery);
        List<Object> objects = query.getResultList();

        objects.stream().forEach((x) -> System.out.println(x));
        entityManager.getTransaction().commit();

    } finally {

        entityManager.close();
        emf.close();
    }
}

```

```java
import org.springframework.format.annotation.DateTimeFormat;
@Entity
@Table(name = "FLIGHT")
public class Flight {

    @Id
    private Long id;

    @Column(name = "ACT_DATETIME", columnDefinition = "Date")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date actualDateTime;

    @Column(name = "PROPAG_DEP_DATETIME", columnDefinition = "Date")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date propDepDateTime;

    @Column(name = "EST_ON_DATETIME", columnDefinition = "Date")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date estOnDateTime;

    @Column(name = "EST_OFF_DATETIME", columnDefinition = "Date")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date estOffDateTime;

```

```sql
DROP TABLE IF EXISTS flight;

CREATE TABLE flight(
id BIGINT PRIMARY KEY , 
ACT_DATETIME TIMESTAMP WITHOUT TIME ZONE,
PROPAG_DEP_DATETIME TIMESTAMP WITHOUT TIME ZONE,
EST_ON_DATETIME TIMESTAMP WITHOUT TIME ZONE,
EST_OFF_DATETIME TIMESTAMP WITHOUT TIME ZONE
);

INSERT INTO flight(ID,ACT_DATETIME, PROPAG_DEP_DATETIME,EST_ON_DATETIME,EST_OFF_DATETIME)
VALUES(
    1,(SELECT now()::timestamp),(SELECT now()::timestamp+1 * INTERVAL '1 DAY'),(SELECT now()::timestamp+2* INTERVAL '1 DAY'),
    (SELECT now()::timestamp+3* INTERVAL '1 DAY')
);

```

On migrating to Postgres I changed jpql as below, but throwing ERROR:

```none
operator does not exist: timestamp without time zone + numeric
  Hint: No operator matches the given name and argument types. You might need to add explicit type casts.

```

Tried multiplying by interval etc. but not worked yet. Any helps welcome.

```java
String jpqlQuery = "SELECT coalesce(c.actualDateTime, "
                    + "coalesce("
                    + "c.propDepDateTime+("
                    + "TO_NUMBER(quote_literal(c.estOnDateTime-c.estOffDateTime),'99999999.99999999')),"
                    + "c.estOnDateTime )) FROM Flight c  ";

```