From: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: now() vs transaction_timestamp()
Date: Fri, 5 Oct 2018 16:29:28 +0300
Message-ID: <6406dbd2-5d37-4cb6-6eb2-9c44172c7e7c@postgrespro.ru> (raw)
Postgres documentation says that |"now()| is a traditional PostgreSQL
equivalent to |transaction_timestamp()|".
Also both use the same implementation.
But them have different parallel safety property:
postgres=# \df+ now
List of functions
Schema | Name | Result data type | Argument data types |
Type | Volatility | Parallel | Owner | Security | Access privileges
| Language |
Source code | Description
------------+------+--------------------------+---------------------+------+------------+------------+----------+----------+-------------------+----------+
-------------+--------------------------
pg_catalog | now | timestamp with time zone | | func | stable |
restricted | knizhnik | invoker | | internal |
now | current transaction time
(1 row)
postgres=# \df+ transaction_timestamp
List of functions
Schema | Name | Result data type |
Argument data types | Type | Volatility | Parallel | Owner | Security
| Access privileg
es | Language | Source code | Description
------------+-----------------------+--------------------------+---------------------+------+------------+----------+----------+----------+----------------
---+----------+-------------+--------------------------
pg_catalog | transaction_timestamp | timestamp with time zone
| | func | stable | safe | knizhnik |
invoker |
| internal | now | current transaction time
(1 row)
As a result using now() in query disable parallel execution while
transaction_timestamp allows it.
Was it done intentionally or it is just a bug?
--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: k.knizhnik@postgrespro.ru
Subject: Re: now() vs transaction_timestamp()
In-Reply-To: <6406dbd2-5d37-4cb6-6eb2-9c44172c7e7c@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox