Re: Should we document how column DEFAULT expressions work?

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, 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-06-26 13:36:10
Message-ID: 202406261336.j6nwh25eelo6@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024-Jun-25, David G. Johnston wrote:

> On Tue, Jun 25, 2024 at 9:50 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:

> > FWIW, I disagree that we need to write anything about that in this
> > part of the documentation. I think any argument for doing this could
> > equally be applied to something like re-iterating what the operator
> > precedence rules for arithmetic are, and I don't think that should be
> > mentioned.
>
> I disagree on this equivalence. The time literals are clear deviations
> from expected behavior. Knowing operator precedence rules, they apply
> everywhere equally. And we should document the deviations directly where
> they happen. Even if it's just a short link back to the source that
> describes the deviation. I'm fine with something less verbose pointing
> only to the data types page, but not with nothing.

I agree that it'd be good to have _something_ -- the other stance seems
super unhelpful. "We're not going to spend two lines to explain some
funny rules that determine surprising behavior here, because we assume
you have read all of our other 3000 pages of almost impenetrably dense
documentation" is not great from a user's point of view. The behavior
of 'now' in DEFAULT clauses is something that has been asked about for
decades.

Arithmetic precedence is a terrible straw man argument. Let's put that
aside.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"If it is not right, do not do it.
If it is not true, do not say it." (Marcus Aurelius, Meditations)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2024-06-26 13:59:35 Re: psql (PostgreSQL) 17beta2 (Debian 17~beta2-1.pgdg+~20240625.1534.g23c5a0e) Failed to retrieve data from the server..
Previous Message Ashutosh Bapat 2024-06-26 13:28:12 Re: pgindent exit status if a file encounters an error