Re: Should we document how column DEFAULT expressions work? - Mailing list pgsql-hackers

From Andrei Lepikhov
Subject Re: Should we document how column DEFAULT expressions work?
Date
Msg-id b74aa479-819a-411a-b93e-7abc4d53bc67@gmail.com
Whole thread Raw
In response to Re: Should we document how column DEFAULT expressions work?  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Should we document how column DEFAULT expressions work?
List pgsql-hackers
On 10/17/24 06:19, Bruce Momjian wrote:
> On Fri, Jul  5, 2024 at 05:11:22PM -0400, Bruce Momjian wrote:
>> On Fri, Jul  5, 2024 at 05:03:35PM -0400, Tom Lane wrote:
>>> Bruce Momjian <bruce@momjian.us> writes:
>>>> Well, 'now()' certainly _looks_ like a function call, though it isn't.
>>>> The fact that 'now()'::timestamptz and 'now'::timestamptz generate
>>>> volatile results via a function call was my point.
>>>
>>> The only reason 'now()'::timestamptz works is that timestamptz_in
>>> ignores irrelevant punctuation (or what it thinks is irrelevant,
>>> anyway).  I do not think we should include examples that look like
>>> that, because it will further confuse readers who don't already
>>> have a solid grasp of how this works.
>>
>> Wow, I see that now:
>>
>>     test=> SELECT 'now('::timestamptz;
>>               timestamptz
>>     -------------------------------
>>      2024-07-05 17:04:33.457915-04
>>
>> If I remove the 'now()' mention in the docs, patch attached, I am
>> concerned people will be confused whether it is the removal of the
>> single quotes or the use of "()" which causes insert-time evaluation,
>> and they might try 'now()'.
> 
> Does anyone like this patch?  I changed now()::timestamptz to
> now::timestamptz.
Pardon the noise, but can you consider the idea of replacing the phrase 
'data insertion time' with something like 'immediately before the 
insertion operation starts'? Sometimes people (especially younglings) 
ask which time it is precisely: will it differ for each tuple?

-- 
regards, Andrei Lepikhov




pgsql-hackers by date:

Previous
From: Andrei Lepikhov
Date:
Subject: Re: Considering fractional paths in Append node
Next
From: Tom Lane
Date:
Subject: Re: Should we document how column DEFAULT expressions work?