Skip to content

Commit 47be001

Browse files
committed
BREAKING CHANGE: change default locale to C
The `en_US.UTF-8` locale, which this action previously defaulted to, is not available on all platforms, most notably on Windows 2019. In order to support a wider range of platforms, we better choose a locale that is available everywhere. According to PostgreSQL docs, the C locale is available on everywhere, which means it seemed to be a good candidate for the default value. It occurred to me that since locale is actually used to sort textual data, the `en_US` locale might not work well for other languages. Which means choosing C as a default locale is as good as `en_US` just to get started, but users are advised to choose the locale they wish by creating a database with a proper locale settings or table columns. This change unblocks Windows 2019 support, and adds some other missing operating systems, such as Ubuntu 20.04 and macOS 11, to the testing matrix on CI. Reported-by: Irena Rindos Fixes: #25
1 parent ca880f6 commit 47be001

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ jobs:
1414
strategy:
1515
matrix:
1616
os:
17-
- ubuntu-latest
18-
- windows-latest
19-
- macos-latest
17+
- ubuntu-22.04
18+
- ubuntu-20.04
19+
- windows-2022
20+
- windows-2019
21+
- macos-11
22+
- macos-12
2023
- macos-13
2124
- macos-14
2225
steps:

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ runs:
8383
--pwfile="$PWFILE" \
8484
--auth="scram-sha-256" \
8585
--encoding="UTF-8" \
86-
--locale="en_US.UTF-8" \
86+
--locale="C" \
8787
--no-instructions
8888
8989
# Do not create unix sockets since they are created by default in the

test_action.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ def test_server_encoding(connection: psycopg.Connection):
7676

7777

7878
def test_locale(connection: psycopg.Connection):
79-
"""Test that PostgreSQL's locale is 'en_US.UTF-8'."""
79+
"""Test that PostgreSQL's locale is 'C.UTF-8'."""
8080

8181
lc_collate = connection.execute("SHOW LC_COLLATE").fetchone()[0]
8282
lc_ctype = connection.execute("SHOW LC_CTYPE").fetchone()[0]
8383

84-
assert locale.normalize(lc_collate) == "en_US.UTF-8"
85-
assert locale.normalize(lc_ctype) == "en_US.UTF-8"
84+
assert locale.normalize(lc_collate) == "C.UTF-8"
85+
assert locale.normalize(lc_ctype) == "C.UTF-8"
8686

8787

8888
def test_environment_variables():

0 commit comments

Comments
 (0)