forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit35d50b5
committed
Fix to_number() to correctly ignore thousands separator when it's '.'.
The existing code in NUM_numpart_from_char has hard-wired logic to treat'.' as decimal point, even when we're using a locale-aware format stringand the locale says that '.' is the thousands separator. This results inclearly wrong answers in FM mode (where we must be able to identify thedecimal point location), as per bug report from Patryk Kordylewski.Since the initialization code in NUM_prepare_locale already sets upNp->decimal as either the locale decimal-point string or "." dependingon which decimal-point format code was used, there's really no need tohave any extra logic at all in NUM_numpart_from_char: we only need totest for a match to Np->decimal.(Note: AFAICS there's nothing in here that explicitly checks for thousandsseparators --- rather, any unmatched character is silently skipped over.That's pretty bogus IMO but it's not the issue being complained of.)This is a longstanding bug, but it's possible that some existing appsare depending on '.' being recognized as decimal point even when usinga D format code. Hence, no back-patch. We should probably list thisas a potential incompatibility in the 9.3 release notes.1 parent8cade04 commit35d50b5
1 file changed
+12
-24
lines changedLines changed: 12 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4131 | 4131 |
| |
4132 | 4132 |
| |
4133 | 4133 |
| |
4134 |
| - | |
| 4134 | + | |
4135 | 4135 |
| |
4136 | 4136 |
| |
4137 | 4137 |
| |
| |||
4151 | 4151 |
| |
4152 | 4152 |
| |
4153 | 4153 |
| |
4154 |
| - | |
4155 |
| - | |
4156 |
| - | |
4157 |
| - | |
4158 | 4154 |
| |
4159 | 4155 |
| |
4160 | 4156 |
| |
| 4157 | + | |
| 4158 | + | |
| 4159 | + | |
| 4160 | + | |
| 4161 | + | |
| 4162 | + | |
| 4163 | + | |
4161 | 4164 |
| |
4162 |
| - | |
| 4165 | + | |
| 4166 | + | |
4163 | 4167 |
| |
4164 |
| - | |
| 4168 | + | |
4165 | 4169 |
| |
| 4170 | + | |
4166 | 4171 |
| |
4167 | 4172 |
| |
4168 | 4173 |
| |
4169 | 4174 |
| |
4170 | 4175 |
| |
4171 |
| - | |
4172 |
| - | |
4173 |
| - | |
4174 |
| - | |
4175 |
| - | |
4176 |
| - | |
4177 |
| - | |
4178 |
| - | |
4179 |
| - | |
4180 |
| - | |
4181 |
| - | |
4182 |
| - | |
4183 |
| - | |
4184 |
| - | |
4185 |
| - | |
4186 |
| - | |
4187 |
| - | |
4188 | 4176 |
| |
4189 | 4177 |
| |
4190 | 4178 |
| |
|
0 commit comments
Comments
(0)