Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sO7Qn-00CSFE-CI for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2024 03:10:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sO7Pn-00EhMI-Jk for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2024 03:09:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sO7Pn-00EhMA-9b for pgsql-hackers@lists.postgresql.org; Mon, 01 Jul 2024 03:09:15 +0000 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sO7Pl-004P69-BS for pgsql-hackers@postgresql.org; Mon, 01 Jul 2024 03:09:14 +0000 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-2598f517a33so1327732fac.1 for ; Sun, 30 Jun 2024 20:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719803352; x=1720408152; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+o3lipAw/d8HksLZ7UqgBKONh/gp2Xe7IPwXMHlgDtc=; b=WCBTpkwb7JepD8z486m72wy8FgqmpFUk6epRKcnmjMew9BwMtlIbkVwYHtVtBTBvIO /+VHlMK25teXNtVJG71f5ae9o+ijiXipZ2+d+SU66dbzr7TCFntV7Kfy/llzrTGlNHbU 1dZNuFWCx/AUkdDqXITjeqmORWEcEZ4I1wxlRcHUbTPe+PkiUT9RpVnKpNHmNor5CMdo lR81oDnIwxzyd/aDxPQ8ci+qe9fWTE/5sO5mKe1B7RmT/5PVxCQHB+mpdG+tnLQvNgs1 siSlktMCeLktVWErJqojYrHg5C+H9TQwpj6bon0qY4BzjVAmm6oyWS2gJhYFGYVPFYOB mpgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719803352; x=1720408152; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+o3lipAw/d8HksLZ7UqgBKONh/gp2Xe7IPwXMHlgDtc=; b=lmh2BQPg16Dra0WhfnUD44i9v/I8hCeZpsxv5NI231dGzQRSQkH/PIpEHK3t9p49M1 Rtv4lFKWugNtMYSaHfs3wx9TfPNGVuHVpurGcDf7yvT6WQH/GHtuaUsHWEHV8m30uAbr Jw/shakv6QAICMt0dx/V0REVJgX10uneu6uKCxHoFvsQQM5MSO0WN0g0J19JtQaoaAmk X/5+ugw5YV96/q5qnrzwHPLyULuuKo7fvtu4aAkqlLnBM62YlSBtnEj3FUYczQ+xx16L 5EP2uAg9OMt4I1hw/6z4X+Gq3ngzEF36+rSMDGZBn5EOjwUz2PgTEGv5dVS4vAXIBsWH 9tow== X-Forwarded-Encrypted: i=1; AJvYcCX3dtInz4WyCY/AB7UtBNmvW10+YTB9++48JMfB+8rtaBArHyWWDzkJELEKtv2hw/3+2dkXmyCgBCaMc9L6aDlJMuBmQY97FdDMMKUH X-Gm-Message-State: AOJu0Ywj68Dv00Kvdl9dteSP4nYK2yVBODktMPDZ81d8qpCzyUDl+jjG bJr8z+2pkeyjGyHO7LaF0SfpAIAHL0Aj7VUdr17j988YJfZrtiWLZhBMn2IUBMXvapB91VReO6h vmiZXKM+pInw/miowMKfikVWlQ7U= X-Google-Smtp-Source: AGHT+IE2xBbUMbbtG5YiYekcAkXEBvepPO99HT24+J9htXO34947uPHQsVzUpwVw4091WY34wP2I9BWus+V/7pZC/6U= X-Received: by 2002:a05:6871:283:b0:25d:643d:4351 with SMTP id 586e51a60fabf-25db362b93cmr4390357fac.51.1719803351704; Sun, 30 Jun 2024 20:09:11 -0700 (PDT) MIME-Version: 1.0 References: <1362410.1719349169@sss.pgh.pa.us> <1390099.1719357084@sss.pgh.pa.us> <1642803.1719447063@sss.pgh.pa.us> In-Reply-To: From: "David G. Johnston" Date: Sun, 30 Jun 2024 20:08:33 -0700 Message-ID: Subject: Re: Should we document how column DEFAULT expressions work? To: David Rowley Cc: Peter Eisentraut , Tom Lane , James Coleman , pgsql-hackers Content-Type: multipart/alternative; boundary="000000000000dcab98061c26eb09" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000dcab98061c26eb09 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jun 30, 2024 at 7:52=E2=80=AFPM David Rowley = wrote: > On Mon, 1 Jul 2024 at 13:41, David G. Johnston > 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. --000000000000dcab98061c26eb09 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Jun 30, 2024 at 7:52=E2=80=AFPM David Rowley <<= a href=3D"mailto:dgrowleyml@gmail.com">dgrowleyml@gmail.com> wrote:<= /span>
On Mon, 1 Jul 2024 at 13:41, David G. Johnston
<david.g= .johnston@gmail.com> wrote:
> I presume the relatively new atomic SQL functions pose a similar hazar= d.

Do you have an example of this?


= create function test= now() returns timestamptz language sql
return 'no= w'::timestamptz;

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

Which conforms with the documentat= ion and expression parsing rules for literals:

"T= his form is parsed at function definition time, the string constant form is= parsed at execution time;..."

David J.
=

--000000000000dcab98061c26eb09--