Re: BUG #13812: 'now' acting differently than now() in function
| От | Tom Lane |
|---|---|
| Тема | Re: BUG #13812: 'now' acting differently than now() in function |
| Дата | |
| Msg-id | 22199.1449787723@sss.pgh.pa.us обсуждение |
| Ответ на | Re: BUG #13812: 'now' acting differently than now() in function ("David G. Johnston" <david.g.johnston@gmail.com>) |
| Список | pgsql-bugs |
"David G. Johnston" <david.g.johnston@gmail.com> writes: > On Thu, Dec 10, 2015 at 12:52 PM, <darin@darinhoward.com> wrote: >> I would not expect the date2 on row 2 to be the same date2 as row 1. > âI may be missing a nuance here, this could > maybe use better documentation surrounding implications, but the basic > answer is that 'now' is a string literal that ends up getting resolved at > parse time during the first invocation of the function and then its value > is cached and re-used during subsequent executions. The "now()" volatile > function is instead left alone by the parser and instead is invoked during > each execution of the UPDATE. > I am going from memory here since I cannot locate the documentation that > points out this fact... There's some discussion near the bottom of this page: http://www.postgresql.org/docs/9.4/static/plpgsql-implementation.html regards, tom lane
В списке pgsql-bugs по дате отправления: