public inbox for [email protected]  
help / color / mirror / Atom feed
DEFAULT in update & prepared statements
3+ messages / 2 participants
[nested] [flat]

* DEFAULT in update & prepared statements
@ 2023-11-08 16:02  Sanjay Minni <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Sanjay Minni @ 2023-11-08 16:02 UTC (permalink / raw)
  To: [email protected]

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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: DEFAULT in update & prepared statements
@ 2023-11-08 17:21  David G. Johnston <[email protected]>
  parent: Sanjay Minni <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2023-11-08 17:21 UTC (permalink / raw)
  To: Sanjay Minni <[email protected]>; +Cc: [email protected] <[email protected]>

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

> 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 ..
>

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.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: DEFAULT in update & prepared statements
@ 2023-11-08 17:30  David G. Johnston <[email protected]>
  parent: David G. Johnston <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: David G. Johnston @ 2023-11-08 17:30 UTC (permalink / raw)
  To: Sanjay Minni <[email protected]>; +Cc: [email protected] <[email protected]>

On Wednesday, November 8, 2023, David G. Johnston <
[email protected]> wrote:

> On Wednesday, November 8, 2023, Sanjay Minni <[email protected]>
> wrote:
>
>> 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 ..
>>
>
> 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.
>

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.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2023-11-08 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-08 16:02 DEFAULT in update & prepared statements Sanjay Minni <[email protected]>
2023-11-08 17:21 ` David G. Johnston <[email protected]>
2023-11-08 17:30   ` David G. Johnston <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox