I am new to Postgres DB. I am getting the error:
invalid input syntax for type timestamp with time zone: ""
when trying to run the below query from java. ":from_date" and ":upto_date" will be replaced with null while executing in java. Any ideas on how to resolve this?
select tm.*
from team tm
and tm.schedule_finish >= (case
when :from_date is null or :upto_date is null
then TO_CHAR(to_date(concat(TO_CHAR(LOCALTIMESTAMP - INTERVAL '1 month','YYYY-MM') , '-01'),'YYYY-MM-DD'),'YYYY-MM-DD')
when (date_part('year',age(:upto_date,:from_date))*12+date_part('month',age(:upto_date,:from_date)))>36
then TO_CHAR(to_date(concat(TO_CHAR(LOCALTIMESTAMP -INTERVAL '1 month','YYYY-MM') , '-01'),'YYYY-MM-DD'),'YYYY-MM-DD')
else TO_CHAR(:from_date,'YYYY-MM-DD')
end)::timestamp
java.time.LocalDateTimethen the error you have can't happen. What data type isschedule_finishI assume that istimestamp?to_date()toto_char()