Using function least and greatest on timestamp in PostgreSQL

postgresql, sql, type-conversion

Solution

select *
from some_table
where plc_time = greatest(timestamp '2013-07-15 14:55:00', timestamp '2013-03-01 17:43:00');

Problem

How can I use function least/greatest in PostgreSQL on timestamp column? I have a column - plc_time (timestamp without time zone) and I need to select rows where the plc_time is greatest from two values (the value is timestamp without time zone). Should I use the conversion? How can I do it?

Original source