This is probably highly ill-advised and totally unsupported by JOOQ, but... 
is it possible to get Postgresql timestamp range types working in JOOQ? I 
got close, but not quite there:

Example:

create table appointment (
  appointment_id serial primary key,
  period tsrange not null
);


1) Inserting tsrange types: 
I do this with an insert and update trigger that constructs a tsrange. Easy 
enough. Initially I tried simply passing a String to 
AppointmentRecord.setPeriod similar to: tsrange('2015-01-01 00:00', 
'2015-02-01 00:00') but that fails with the exception: "ERROR: column 
"period" is of type tsrange but expression is of type character varying. 
Hint: You will need to rewrite or cast the expression.".

2) Using tsrange and range operators as a WHERE condition:
This is the bit I can't get working. I tried code similar to: 

    String condition = "appointment.period && tsrange('2015-01-01 00:00', 
'2015-02-01 00:00')";
    List<Appointment> appointments = 
DSL.select().from(APPOINTMENT).where(condition).fetchInto(Appointment.class); 
// JOOQ POJO

This actually executes without error in JOOQ, and the debug output show it 
as having selected rows, but the List comes back null.

The above was tried with: Java 8, JOOQ 3.4, Postgresql 9.3, and whatever 
the most recent Postgresql JDBC driver was about a month ago.

Thanks in advance for any ideas, etc. 


-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to