The correct data type to store a duration is interval
.
This makes it easy to do date arithmetic: you can simply add the duration to the start time to get the end time:
SELECT INTERVAL '01:30:00';
interval
----------
01:30:00
(1 row)
SELECT TIME '09:00:00' + INTERVAL '01:30:00';
?column?
----------
10:30:00
(1 row)
SELECT TIMESTAMP WITH TIME ZONE '2021-03-28 02:00:00+01' + INTERVAL '01:30:00';
?column?
------------------------
2021-03-28 04:30:00+02
(1 row)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…