How to get a real time within PostgreSQL transaction?

Use clock_timestamp().

now() is a traditional PostgreSQL equivalent to transaction_timestamp(), which is equivalent to CURRENT_TIMESTAMP. These functions return the start time of the current transaction. Their values do not change during the transaction.

statement_timestamp() returns the time of receipt of the latest command message from the client.

clock_timestamp() returns the actual current time, and therefore its value changes even within a single SQL command.

For more information see the documentation.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)