Check that numeric is zero

2023-05-06 Thread Gabriel Furstenheim Milerud
Hi, I'm writing a Postgres native extension and I would like to check that a numeric is zero. My problem is that all exported methods like numeric_eq or numeric_sign require me to have a numeric to start with, and const_zero is not exported in numeric.c. Any idea how to check it? Thanks Gabriel

Re: Converting to number with given format

2018-09-20 Thread Gabriel Furstenheim Milerud
Hi Ken, Thanks a lot, that's a cool idea and I think that it will cover my needs. On Thu, 20 Sep 2018 at 02:04, Ken Tanzer wrote: > On Wed, Sep 19, 2018 at 6:34 AM Gabriel Furstenheim Milerud < > furstenh...@gmail.com> wrote: > > Maybe that is not possible with numbers?

Re: Converting to number with given format

2018-09-19 Thread Gabriel Furstenheim Milerud
aver wrote: > On 9/19/18 6:11 AM, Gabriel Furstenheim Milerud wrote: > > I'm not completely sure that that actually works > > > > SELECT to_number('9,134','9V3') =9 > > SELECT (to_number('9,134', '9')/1000)::numeric(4,3); > numeric > - > 9.13

Re: Converting to number with given format

2018-09-19 Thread Gabriel Furstenheim Milerud
, 19 Sep 2018 at 14:57, Adrian Klaver wrote: > On 9/19/18 5:38 AM, Gabriel Furstenheim Milerud wrote: > > Hello, > > I'd like to convert a string number to a number being able to provide > > the custom format. > > With dates it works perfectly fine, so that I can do: >

Converting to number with given format

2018-09-19 Thread Gabriel Furstenheim Milerud
Hello, I'd like to convert a string number to a number being able to provide the custom format. With dates it works perfectly fine, so that I can do: SELECT to_date('18 09 10', 'YY MM DD') Is there something similar with numbers? SELECT to_number('9,000', some_format) = 9; SELECT