Search code examples
postgresqlepoch

extract timestamp from EPOCH cloumn from postgresql DB table


I am trying to execute below-mentioned PostgreSQL query and in which checkin_ts in epoch format and want to write a query which is humanly understandable(putting timestamp in human readable format).

select * from users where to_timestamp(checkin_ts) >= '2017-11-11 00:00:00'
LIMIT 100;

when I tried to execute the above query then I get the following error

ERROR:  execute cannot be used while an asynchronous query is underway

Solution

  • You need to give us the description of your table, to know checkin_ts format.

    But to_timestamp need to text paramaters like this :

    SELECT * 
      FROM users 
     WHERE to_timestamp(checkin_ts::text, 'YYYY-MM-DD HH24:MI:SS') >= '2017-11-11 00:00:00' LIMIT 100;
    

    And what is your environment to execute this query ? The error seems to be that you are trying to execute two queries on the same connection using two different cursors.