Can I pass in a frozen time as a setting into postgresql and not have clock drift? I would like to freeze time on a connection level across multiple transactions. Is there a conventional way of achieving this similar to

SET search_path = 'foo';


Rather than me passing in the time and binding it on each statement myself? Ideally I would want to be able to use NOW() and write conventional SQL, but freeze that time across multiple transactions.

The reason for this is because I want to avoid clock drift on a single web request.
You could abuse a placeholder variable:

SET request.time = '2019-11-21 09:00:00';


Then you can use current_setting('request.time') in your queries to retrieve the string.