Hi,
I tried with
SELECT comment_id FROM comments WHERE create_time < '1 Jan 1800';
But the result is same: ERROR 22008 timestamp out of range.
With the help from #postgresql community, I successfully extract the min(create_time) with below query:
SELECT min(trim(leading '\' from timestamp_send(create_time)::text)::bit(64)::bigint) FROM comments;
min
-------
-332024613738615000
Which is in microseconds from 2000-01-01 00:00:00 and the result is correspond to ~10500 BC. Way out of range. CMIIW
So, while trying to figure out the "broken" rows with this query:
SELECT comment_id FROM comments WHERE trim(leading '\' from timestamp_send(create_time)::text)::bit(64)::bigint > -31556908800000000
And there are many rows, 800+. So, I guess this looks like corrupted data in the table.
A while ago, the server was crashed when our datacenter experienced power outage. But I didn't checked anything until today. It seems that what's left is how do I fix this because we don't store old backups.
For your information, I forgot to mention that this is Postgres 9.3.15 with fsync=ON.