0

I'm having quite a bit of trouble preparing this SQL statement for PostgreSQL using JDBI. I get an error when trying to apply a Java Long to a SQL column type of bigint. When I execute the following:

Long valLong = System.currentTimeMillis();
handle.createQuery("INSERT INTO table (valCol)"
                    + "VALUES (:val) "
                + "RETURNING *")
                    .bind("val", valLong)
                    .map(Mapper.instance)
                    .list());

I get the following error:

org.postgresql.util.PSQLException: ERROR: column "val" is of type bigint but expression is of type character varying

Any help is extremely appreciated!

  • 1
    Please include the full Java code along with the Postgres table definition. – Tim Biegeleisen 20 hours ago
  • How exactly is valLong defined in Java? – a_horse_with_no_name 18 hours ago
  • @a_horse_with_no_name It is set as Long valLong = System.currentTimeMillis(); – btbam91 10 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.