Subject: DEFAULT in update & prepared statements

From: Sanjay Minni <[email-masked]>
Date: Wed, 8 Nov 2023 21:32:16 +0530

Can DEFAULT (defined for a timestamp column as now() ) be used in
1. prepared statement i.e. EXECUTE ( ..., DEFAULT, ...)
2. in an UPDATE statement  UPDATE TABLE SET update_time = DEFAULT ...

thanks
Sanjay

---

From: "David G. Johnston" <[email-masked]>
Date: Wed, 8 Nov 2023 10:21:20 -0700

On Wednesday, November 8, 2023, Sanjay Minni <[email-masked]> wrote:

> 2. in an UPDATE statement  UPDATE TABLE SET update_time = DEFAULT ..
>

5 seconds looking at the syntax for update in the docs answers the second
question.

The first question doesn’t really make sense - but regardless of what you
are trying to communicate there just try it.  If the result you get doesn’t
make sense post what you tried.

David J.

---

From: "David G. Johnston" <[email-masked]>
Date: Wed, 8 Nov 2023 10:30:23 -0700

> make sense post what you tried.

As the docs do not show DEFAULT for execute the answer is indeed no for the
first question.  Default behaves as syntax for the query and syntax, like
identifiers, cannot be parameterized.

David J.