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 numb

Re: Converting to number with given format

2018-09-19 Thread Gabriel Furstenheim Milerud
2018 at 15:22, Adrian Klaver 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'

Re: Converting to number with given format

2018-09-19 Thread Gabriel Furstenheim Milerud
27;9V3') Is 1, not 19.134 or even 19 On Wed, 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

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 to_numb

pg10 logical replication set schema

2018-01-30 Thread Gabriel Furstenheim Milerud
Hi, I've been following https://hackernoon.com/postgresql-logical-replication-86df5b51cc5a to set up logical replication. I've created the table in master and publication create table test_table_replication (a int); create publication test_table_replication_pub for table test_table_replic

Enforcing users to write schemas when creating tables

2017-12-20 Thread Gabriel Furstenheim Milerud
Hi, I'm trying to enforce db users to write a schema when creating a table. That is: create table some_schema.my_table (a int); -- should succeed create my_table (a int); -- should fail I don't know if that is possible. What I've tried so far is to create a schema which is first in th