Skip to content

Conversation

@dveeden
Copy link

@dveeden dveeden commented Nov 10, 2025

Fixes https://bugs.mysql.com/bug.php?id=82085

In sql/sql/locale.cc there is this for bg_BG:

                          '\0',       /* thousands_sep bg_BG */
                          "\x03\x03", /* grouping      bg_BG */

Other locales that set \0 as thousounds separator have grouping set to \x80\x80, but the bg_BG locale doesn't.

The result is that FORMAT(12345.67,3,'bg_BG') has a NUL character as thousands separator.

Before this commit:

mysql> SELECT FORMAT(12345.67, 3, 'bg_BG');
+------------------------------+
| FORMAT(12345.67, 3, 'bg_BG') |
+------------------------------+
| 12 345,670                   |
+------------------------------+
1 row in set (0.001 sec)

mysql> SELECT HEX(FORMAT(12345.67, 3, 'bg_BG'));
+-----------------------------------+
| HEX(FORMAT(12345.67, 3, 'bg_BG')) |
+-----------------------------------+
| 3132003334352C363730              |
+-----------------------------------+
1 row in set (0.001 sec)

With this commit:

mysql> SELECT FORMAT(12345.67,3,'bg_BG');
+----------------------------+
| FORMAT(12345.67,3,'bg_BG') |
+----------------------------+
| 12345,670                  |
+----------------------------+
1 row in set (0.001 sec)

mysql> SELECT HEX(FORMAT(12345.67,3,'bg_BG'));
+---------------------------------+
| HEX(FORMAT(12345.67,3,'bg_BG')) |
+---------------------------------+
| 31323334352C363730              |
+---------------------------------+
1 row in set (0.001 sec)

Other options considered:

  1. Change the grouping for bg_BG to \x80\x80. This would probably have the same result, but allows for newly added locales to have the same issue later on.
  2. Change the thousands separator for bg_BG to (space, 0x20). This would result in output that may be visually similar depending on the client, but it seems like no thousands separator was the intended behavior.

Fixes https://bugs.mysql.com/bug.php?id=82085

In `sql/sql/locale.cc` there is this for `bg_BG`:
```
                          '\0',       /* thousands_sep bg_BG */
                          "\x03\x03", /* grouping      bg_BG */
```

Other locales that set `\0` as thousounds separator have grouping set to
`\x80\x80`, but the `bg_BG` locale doesn't.

The result is that `FORMAT(12345.67,3,'bg_BG')` has a NUL character as thousands
separator.

Before this commit:
```
mysql> SELECT FORMAT(12345.67, 3, 'bg_BG');
+------------------------------+
| FORMAT(12345.67, 3, 'bg_BG') |
+------------------------------+
| 12 345,670                   |
+------------------------------+
1 row in set (0.001 sec)

mysql> SELECT HEX(FORMAT(12345.67, 3, 'bg_BG'));
+-----------------------------------+
| HEX(FORMAT(12345.67, 3, 'bg_BG')) |
+-----------------------------------+
| 3132003334352C363730              |
+-----------------------------------+
1 row in set (0.001 sec)
```

With this commit:
```
mysql> SELECT FORMAT(12345.67,3,'bg_BG');
+----------------------------+
| FORMAT(12345.67,3,'bg_BG') |
+----------------------------+
| 12345,670                  |
+----------------------------+
1 row in set (0.001 sec)

mysql> SELECT HEX(FORMAT(12345.67,3,'bg_BG'));
+---------------------------------+
| HEX(FORMAT(12345.67,3,'bg_BG')) |
+---------------------------------+
| 31323334352C363730              |
+---------------------------------+
1 row in set (0.001 sec)
```
@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@dveeden
Copy link
Author

dveeden commented Nov 10, 2025

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=119356 for updates.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants