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

From David G. Johnston
Subject Re: Should we document how column DEFAULT expressions work?
Date
Msg-id CAKFQuwZ33QTgBw9P1MbZyn7gim_MopJFg0qJSpnvSsVcMXte+Q@mail.gmail.com
Whole thread Raw
In response to Should we document how column DEFAULT expressions work?  (James Coleman <jtc331@gmail.com>)
List pgsql-hackers
On Tuesday, June 25, 2024, James Coleman <jtc331@gmail.com> wrote:
Hello,

It's possible I'm the only one who's been in this situation, but I've
multiple times found myself explaining to a user how column DEFAULT
expressions work: namely how the quoting on an expression following
the keyword DEFAULT controls whether or not the expression is
evaluated at the time of the DDL statement or at the time of an
insertion.

I don’t know if it’s worth documenting but the following sentence is implied by the syntax:

“Do not single quote the expression as a whole.  Write the expression as you would in a select query.”

David J.

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Should we document how column DEFAULT expressions work?
Next
From: David Rowley
Date:
Subject: Re: Should we document how column DEFAULT expressions work?