Re: Change atoi to strtol in same place

2019-09-06 Thread Joe Nelson
Alvaro Herrera from 2ndQuadrant wrote: > Okay, so who is submitting a new version here? Surafel, Joe? Sure, I'll look into it over the weekend.

Re: Change atoi to strtol in same place

2019-09-09 Thread Joe Nelson
ht not be too clean. Maybe there's a better place for the function. -- Joe Nelson https://begriffs.com diff --git a/contrib/pg_standby/Makefile b/contrib/pg_standby/Makefile index 0bca2f8e9e..cb9292d0f4 100644 --- a/contrib/pg_standby/Makefile +++ b/contrib/pg_standby/Makefile @@ -6,6

Re: Change atoi to strtol in same place

2019-09-10 Thread Joe Nelson
rvice I can use to test my patches across multiple platforms? I'd rather not bother reviewers with build problems that I can catch in a more automated way. -- Joe Nelson https://begriffs.com

Re: Change atoi to strtol in same place

2019-09-11 Thread Joe Nelson
eck for example in [1]). The pg_strto[u]intXX_check functions can return the integer directly only because they handle errors with ereport(ERROR, ...). However, as I mentioned earlier, this is not always what the front-end utilities need to do. -- Joe Nelson https://begriffs.com

Re: Change atoi to strtol in same place

2019-09-27 Thread Joe Nelson
Alvaro Herrera wrote: > ... can we have a new patch? Not only because there seems to have > been some discussion points that have gone unaddressed (?) Yes, I'll work on it over the weekend. > but also because Appveyor complains really badly about this one. > https://ci.appveyor.com/project/postg

Re: Change atoi to strtol in same place

2019-09-29 Thread Joe Nelson
a failure for ports, and allow integer parse errors. -- Joe Nelson https://begriffs.com diff --git a/contrib/pg_standby/Makefile b/contrib/pg_standby/Makefile index 0bca2f8e9e..cb9292d0f4 100644 --- a/contrib/pg_standby/Makefile +++ b/contrib/pg_standby/Makefile @@ -6,6 +6,8 @@ PGAPPI

Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays

2019-10-02 Thread Joe Nelson
Isaac Morland wrote: > I hope you'll forgive a noob question. Why does the "After" > initialization for the boolean array have {0} rather than {false}? I think using a value other than {0} potentially gives the incorrect impression that the value is used for *all* elements of the array/structure,

Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays

2019-10-02 Thread Joe Nelson
> If so, I don't suppose it's possible to give empty braces: > > bool nulls[Natts_pg_attribute] = {}; GNU does add this capability as a nonstandard language extension, but according to the C99 standard, no.

Re: Change atoi to strtol in same place

2019-10-03 Thread Joe Nelson
Kyotaro Horiguchi wrote: > > pg_standby: -k keepfiles could not parse 'hoge' as integer > > I didn't checked closely, but -k of pg_standby's message looks > somewhat strange. Needs a separator? Good point, how about this: pg_standby: -k keepfiles: > Building a sentense just concatenatin

Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays

2019-10-04 Thread Joe Nelson
Amit Kapila wrote: > > How about I just define them both the same? > > #define INIT_ALL_ELEMS_ZERO {0} > > #define INIT_ALL_ELEMS_FALSE{0} > > I think using one define would be preferred, but you can wait and see > if others prefer defining different macros for the same thing. +1 on using

Re: Change atoi to strtol in same place

2019-10-06 Thread Joe Nelson
think it should be OK though, since we return the pg_strtoint_status so callers can inspect that rather than relying on certain words being in the error string. I'm guessing the translated string would be most appropriate for end users. -- Joe Nelson https://begriffs.com diff --git a/cont

Re: Change atoi to strtol in same place

2019-10-07 Thread Joe Nelson
ting a version of the function for int32 > and int64 and directly passing in the variable to be set. One complication is that the destination values are often int rather than int32, and I don't know their width in general (probably 32, maybe 16, but *possibly* 64?). The pg_strtoint64_range() function with range argument of INT_MAX is flexible enough to handle whatever situation we encounter. Am I overthinking this part? -- Joe Nelson https://begriffs.com

Re: Change atoi to strtol in same place

2019-10-11 Thread Joe Nelson
Here's v6 of the patch. [x] Rebase on 20961ceaf0 [x] Don't call exit(1) after pg_fatal() [x] Use Tom Lane's suggestion for %lld in _() string [x] Allow full unsigned 16-bit range for ports (don't disallow ports 0-1023) [x] Explicitly cast parsed values to smaller inte

Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays

2019-10-21 Thread Joe Nelson
> > I don't understand why this is an issue worth deviating from the > > standard for. > > Because this use and the way the standard is defined in this case is > confusing and could lead later hackers to misunderstand what's going on > and end up creating bugs- The two possible misunderstandings

Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays

2019-10-21 Thread Joe Nelson
> Is it possible to define the macro to be {} where supported and {0} > where needed? Something like: If it's being put behind a macro then *stylistically* it shouldn't matter whether {} or {0} is chosen, right? In which case {0} would be a better choice because it's supported everywhere.

Re: Change atoi to strtol in same place

2019-07-23 Thread Joe Nelson
> Surafel Temesgen wrote: > > we use atoi for user argument processing in same place which return > > zero for both invalid input and input value zero. [...] in same > > place where we accept zero as valued input it case a problem by > > preceding for invalid input as input value zero. strtol whic

Re: Optimization of some jsonb functions

2019-07-26 Thread Joe Nelson
nto a single patch, sorry if that makes it harder to review than the original set of five patch files... -- Joe Nelson https://begriffs.com diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c index 69f41ab455..8dced4ef6c 100644 --- a/src/backend/utils/adt/jsonb.c +++ b/src

Re: Change atoi to strtol in same place

2019-12-06 Thread Joe Nelson
I see this patch has been moved to the next commitfest. What's the next step, does it need another review? -- Joe Nelson https://begriffs.com

Re: refactoring - standardize integer parsing in front-end utilities

2020-01-12 Thread Joe Nelson
Joe Nelson wrote: > > I see this patch has been moved to the next commitfest. What's the next > > step, does it need another review? Peter Eisentraut wrote: > I think you need to promote your patch better. Thanks for taking the time to revive this thread. Quick sales

Re: POC: rational number type (fractions)

2020-07-02 Thread Joe Nelson
> > I think we mark this as rejected. Stephen Frost wrote: > The more we reject new things, the less appealing our community ends > up being. For what it's worth, I'm not disheartened if my rational patch is rejected. I can appreciate that postgres wants to avoid what might be feature creep, espe

POC: rational number type (fractions)

2020-02-07 Thread Joe Nelson
.postgresql.org/wiki/User-specified_ordering_with_fractions 1: https://begriffs.com/posts/2018-03-20-user-defined-order.html 2: https://github.com/begriffs/pg_rational -- Joe Nelson https://begriffs.com diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefile index 13ef

Re: POC: rational number type (fractions)

2020-02-21 Thread Joe Nelson
the trick? So '1/2'::rational < 1 would cast 1 to '1/1' and compare? I have currently included these casts: integer -> rational, float8 <-> rational. Don't have one for numeric yet. > Regards, Thank you for taking the time to raise those questions. -- Joe Nelson https://begriffs.com

Re: POC: rational number type (fractions)

2020-02-21 Thread Joe Nelson
Joe Nelson wrote: > where the denominator is made positive whenever possible (not possible > when it's -INT_MAX). (I meant INT_MIN rather than -INT_MAX.) Another more-than-one-way-to-do-it task is converting a float to a fraction. I translated John Kennedy's method [0] to C,

Re: Change atoi to strtol in same place

2020-03-04 Thread Joe Nelson
Daniel Gustafsson wrote: > > On 11 Feb 2020, at 17:54, Alvaro Herrera wrote: > > > > This patch doesn't currently apply; it has conflicts with at least > > 01368e5d9da7 and 7e735035f208; even in 7e735035f208^ it applies with > > fuzz. Please post an updated version so that it can move forward. >