Re: BUG #14322: Possible inconsistent behavior with timestamp_to_str()
От | Keith |
---|---|
Тема | Re: BUG #14322: Possible inconsistent behavior with timestamp_to_str() |
Дата | |
Msg-id | CAHw75vuZZSY_d+cH8WEBU6weKLQynHWx+a7WT4t-S9d8_1dk3g@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #14322: Possible inconsistent behavior with timestamp_to_str() (Andres Freund <andres@anarazel.de>) |
Ответы |
Re: BUG #14322: Possible inconsistent behavior with timestamp_to_str()
|
Список | pgsql-bugs |
On Fri, Sep 9, 2016 at 8:02 PM, Andres Freund <andres@anarazel.de> wrote: > On 2016-09-09 23:54:48 +0000, keith@keithf4.com wrote: > > The following bug has been logged on the website: > > > > Bug reference: 14322 > > Logged by: Keith Fiske > > Email address: keith@keithf4.com > > PostgreSQL version: 9.5.4 > > Operating system: Ubuntu 16.04 > > Description: > > > > It seems when I call timestamp_to_str() on a non-null value then call it > on > > a null value in the same statement, it returns the previous non-null > value. > > I've included the code and debug lines from where I encountered this when > > testing my app. > > Uh. You can't just call timestamptz_to_str() on a NULL value. The datum > doesn't have to have any meaningful value if it's null. > > > > I know I should always check for a null return from SPI before operating > on > > a value, and I do before I actually use those values. But I had them in > my > > debug lines where checking for whether they're null before outputting to > > debug didn't seem to matter and it was really confusing me why the values > > were returning recent timestamp values when I was pretty sure they were > > null. Not sure if this can just be chalked up to undefined behavior when > > dealing with nulls or it's an actual problem, so figured I'd report it. > > I don't think there's an issue here. The datum value isn't guaranteed > to be initialized if the value is null, and I think that's what you're > seeing here. > > Greetings, > > Andres Freund > Understood. Just confused me for a while and wanted to make sure it wasn't a real issue. Thanks! Keith
В списке pgsql-bugs по дате отправления: