Postgresql – Unix Epoch timestamp for now() in postgresql

postgresql

I am trying to update one field as epoch from now() but I am getting as '15872897243629.2188' fraction format. What I need is the exact epoch from now() without fraction values like '15872897243629'

here the query I used

UPDATE tablename SET 
column1= extract(epoch from now()),
column2= extract(epoch from now())
where column3= 'SUCCESS';

Best Answer

Add an appropriate type cast:

CAST (EXTRACT (epoch from current_timestamp) AS bigint)