Skip to content

Commit 89179a8

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 89179a8

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,31 @@ jobs:
1414
strategy:
1515
matrix:
1616
os:
17-
- ubuntu-latest
18-
- windows-latest
19-
- macos-latest
20-
- macos-13
17+
- ubuntu-22.04
18+
- ubuntu-20.04
19+
- windows-2022
20+
- windows-2019
2121
- macos-14
22+
- macos-13
23+
- macos-12
2224
steps:
2325
- uses: actions/checkout@v4
2426

2527
- name: Run setup-postgres
2628
uses: ./
2729
id: postgres
2830

31+
- name: Setup tmate session
32+
uses: mxschmitt/action-tmate@v3
33+
with:
34+
limit-access-to-actor: false
35+
if: ${{ failure() }}
36+
37+
- name: Run setup-python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: "3.10"
41+
2942
- name: Run tests
3043
run: |
3144
python3 -m pip install --upgrade pip pytest psycopg furl
@@ -57,6 +70,11 @@ jobs:
5770
port: 34837
5871
id: postgres
5972

73+
- name: Run setup-python
74+
uses: actions/setup-python@v5
75+
with:
76+
python-version: "3.10"
77+
6078
- name: Run tests
6179
run: |
6280
python3 -m pip install --upgrade pip pytest psycopg furl

test_action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ def test_service_name(service_name):
7070

7171

7272
def test_server_encoding(connection: psycopg.Connection):
73-
"""Test that PostgreSQL's encoding is 'UTF-8'."""
73+
"""Test that PostgreSQL's encoding matches the one we passed to initdb."""
7474

7575
assert connection.execute("SHOW SERVER_ENCODING").fetchone()[0] == "UTF8"
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 matches the one we paased to initdb."""
8080

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

0 commit comments

Comments
 (0)