Re: Underscores in numeric literals

2023-02-04 Thread Dean Rasheed
On Thu, 2 Feb 2023 at 22:40, Peter Eisentraut wrote: > > On 31.01.23 17:09, Dean Rasheed wrote: > > On Tue, 31 Jan 2023 at 15:28, Peter Eisentraut > > wrote: > >> > >> Did you have any thoughts about what to do with the float types? I > >> guess we could handle those in a separate patch? > >> >

Re: Underscores in numeric literals

2023-02-02 Thread Peter Eisentraut
On 31.01.23 17:09, Dean Rasheed wrote: On Tue, 31 Jan 2023 at 15:28, Peter Eisentraut wrote: Did you have any thoughts about what to do with the float types? I guess we could handle those in a separate patch? I was assuming that we'd do nothing for float types, because anything we did

Re: Underscores in numeric literals

2023-01-31 Thread Dean Rasheed
On Tue, 31 Jan 2023 at 15:28, Peter Eisentraut wrote: > > Did you have any thoughts about what to do with the float types? I > guess we could handle those in a separate patch? > I was assuming that we'd do nothing for float types, because anything we did would necessarily impact their

Re: Underscores in numeric literals

2023-01-31 Thread Peter Eisentraut
On 23.01.23 21:45, Dean Rasheed wrote: On Wed, 4 Jan 2023 at 09:28, Dean Rasheed wrote: In addition, I think that strip_underscores() could then go away if numeric_in() were made to handle underscores. Essentially then, that would move all responsibility for parsing underscores and

Re: Underscores in numeric literals

2023-01-23 Thread Dean Rasheed
On Wed, 4 Jan 2023 at 09:28, Dean Rasheed wrote: > > In addition, I think that strip_underscores() could then go away if > numeric_in() were made to handle underscores. > > Essentially then, that would move all responsibility for parsing > underscores and non-decimal integers to the datatype

Re: Underscores in numeric literals

2023-01-04 Thread Dean Rasheed
Oh, one other minor nit -- in parser/scan.l: -real ({decinteger}|{numeric})[Ee][-+]?{decdigit}+ +real ({decinteger}|{numeric})[Ee][-+]?{decinteger}+ the final "+" isn't necessary now. Regards, Dean

Re: Underscores in numeric literals

2023-01-04 Thread Dean Rasheed
On Wed, 28 Dec 2022 at 14:28, Andrew Dunstan wrote: > > On 2022-12-27 Tu 09:55, Tom Lane wrote: > > We already accept that numeric input is different from numeric > > literals: you can't write Infinity or NaN in SQL without quotes. > > So I don't see an argument that we have to allow this in

Re: Underscores in numeric literals

2022-12-28 Thread Andrew Dunstan
On 2022-12-27 Tu 09:55, Tom Lane wrote: > We already accept that numeric input is different from numeric > literals: you can't write Infinity or NaN in SQL without quotes. > So I don't see an argument that we have to allow this in numeric > input for consistency. > That's almost the same, but

Re: Underscores in numeric literals

2022-12-27 Thread Justin Pryzby
On Tue, Dec 27, 2022 at 09:55:32AM -0500, Tom Lane wrote: > Peter Eisentraut writes: > > Here is a patch to add support for underscores in numeric literals, for > > visual grouping, like > > > 1_500_000_000 > > 0b10001000_ > >

Re: Underscores in numeric literals

2022-12-27 Thread Tom Lane
Peter Eisentraut writes: > Here is a patch to add support for underscores in numeric literals, for > visual grouping, like > 1_500_000_000 > 0b10001000_ > 0o_1_755 > 0x_ > 1.618_034 > per SQL:202x draft. > This adds s

Underscores in numeric literals

2022-12-27 Thread Peter Eisentraut
Here is a patch to add support for underscores in numeric literals, for visual grouping, like 1_500_000_000 0b10001000_ 0o_1_755 0x_ 1.618_034 per SQL:202x draft. This adds support in the lexer as well as in the integer type input functions. TODO: float