Re: Should we document how column DEFAULT expressions work?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, James Coleman <jtc331(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Should we document how column DEFAULT expressions work?
Date: 2024-07-01 03:08:33
Message-ID: CAKFQuwY1XLR4Xfd6TLE4p1Ks=PNKvncTc19i5FfgngG+Pg5-Eg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jun 30, 2024 at 7:52 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:

> On Mon, 1 Jul 2024 at 13:41, David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> > I presume the relatively new atomic SQL functions pose a similar hazard.
>
> Do you have an example of this?
>
>
create function testnow() returns timestamptz language sql
return 'now'::timestamptz;

select testnow();
select pg_sleep(5);
select testnow(); -- same time as the first call

Which conforms with the documentation and expression parsing rules for
literals:

"This form is parsed at function definition time, the string constant form
is parsed at execution time;..."

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-07-01 03:14:58 Re: Should we document how column DEFAULT expressions work?
Previous Message Masahiro.Ikeda 2024-07-01 02:55:54 RE: Improve EXPLAIN output for multicolumn B-Tree Index