My educated guess: you have a leading BOM (byte order mark) in the file that should be removed.
Or some exotic whitespace or non-printing character that should be removed or replaced.
And the offending character (well, the BOM is not a "character", strictly speaking, it's just mistaken for one) was not copied to the question. That would explain the otherwise contradicting error message.
To test, copy the "2018-04-18 05:40:28"
part from the error message and paste it in a pgAdmin SQL editor window (which you seem to be using) and test:
SELECT '"2018-04-18 05:40:28"' = '"2018-04-18 05:40:28"';
---------^ BOM here?
I added a leading BOM to demonstrate in the first string. Type the second string by hand to be sure it's plain ASCII. If you get false
, we are on to something here.
But we cannot be too sure, your question is confusing and essential information is missing. Don't use the basic type names timestamp
and date
as identifiers, for sanity.