how do you add two date in postgresql?
I tried this, but this gives an error
select finish_time + arrival_time from file_info
ERROR: operator is not unique: time without time zone + time without time zone
LINE 1: select finish_time + arrival_time from file_info
HINT: Could not choose a best candidate operator. You might need to add explicit type casts.
finish_time , arrival_time these are time without time zone.
I would expect the answer to be 08:03:03
Sorry I didn't see that those were not columns of type date (mainly because you wrote "how can I add two dates" )
Unfortunately you can only add an interval to a time value. But with a little trick you can "convert" the time into an interval:
SELECT finish_time + (interval '1' second) * extract(epoch from time arrival_time)
This works as follows:
extract(epoch from time arrival_time) converts the time into seconds. Those seconds are then "converted" to an interval by multiplying a one second interval with them. The resulting interval can then be added to the date value.