Created
March 28, 2013 18:28
-
-
Save erik-megarad/5265641 to your computer and use it in GitHub Desktop.
TIL: Postgres freezes now() to the start-time of the transaction while inside a transaction.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psql (9.1.3) | |
Type "help" for help. | |
dev=# select now(); | |
now | |
------------------------------- | |
2013-03-28 14:27:28.820854-04 | |
(1 row) | |
dev=# select now(); | |
now | |
------------------------------- | |
2013-03-28 14:27:29.610072-04 | |
(1 row) | |
dev=# begin; | |
BEGIN | |
dev=# select now(); | |
now | |
------------------------------- | |
2013-03-28 14:27:31.129983-04 | |
(1 row) | |
dev=# select now(); | |
now | |
------------------------------- | |
2013-03-28 14:27:31.129983-04 | |
(1 row) | |
dev=# select now(); | |
now | |
------------------------------- | |
2013-03-28 14:27:31.129983-04 | |
(1 row) | |
dev=# commit; | |
COMMIT | |
dev=# select now(); | |
now | |
------------------------------- | |
2013-03-28 14:27:41.538059-04 | |
(1 row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment