Parallel safety of CURRENT_* family

From: <5bih4k+4jfl6m39j23k(at)guerrillamail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Parallel safety of CURRENT_* family
Date: 2016-12-01 19:06:24
Message-ID: 937ac7744dee7956324d43149b821538e357@guerrillamail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

How should I mark a function which calls CURRENT_DATE? Parallel safe or parallel restricted?

pg_proc shows that now() is marked as restricted, but transaction_timestamp() is marked as safe.

The manual (https://www.postgresql.org/docs/9.6/static/functions-datetime.html) says that "now() is a traditional PostgreSQL equivalent to transaction_timestamp()" and "transaction_timestamp() is equivalent to CURRENT_TIMESTAMP".

The code seems to confirm: GetSQLCurrentDate(), GetSQLCurrentTimestamp() and now() all invoke the same GetCurrentTransactionStartTimestamp().

It looks like that functions which uses the CURRENT_* family of functions should be marked as restricted (something to add to the docs) and that transaction_timestamp() is incorrectly marked as safe.

Am I wrong?

Mark Kolar

----
Sent using Guerrillamail.com
Block or report abuse: https://www.guerrillamail.com/abuse/?a=UUZnFAFNS7UWgwum414PfQfTStiVwcZciatQew%3D%3D

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-12-01 19:13:44 Re: pgbench - allow backslash continuations in \set expressions
Previous Message Robert Haas 2016-12-01 18:50:49 Re: [HACKERS] Re: [HACKERS] 答复: [HACKERS] postgres 1 个(共 2 个) can pg 9.6 vacuum freeze skip page on index?