Supabase and PostgresDatabase and Postgresreference
Postgres collation version drift and REFRESH COLLATION VERSION
Postgres sorts text with a C library or with ICU (International Components for Unicode), and a btree index on a text column stores keys in the order that library gave at build time. Change the library under an existing data directory - an image bump, a restore onto a newer host, a physical standby on a newer image - and the library may order some keys differently while the index keeps the old order. Postgres records a collation version to warn about this. This page measures what the warning says, when an index is wrong behind it, and what ALTER DATABASE ... REFRESH COLLATION VERSION does.
TL;DR
- A connection to a database whose recorded collation version differs from the one the running library reports gets one
WARNINGnaming both versions and the command to refresh. An explicit collation (en_US.utf8orund-x-icuinpg_catalog) raises its own warning once per session, on the first comparison that uses it. The record is per database:postgresandtemplate1carry their own versions and warn separately (CD01).1 - The version change and the sort change are separate facts. Between glibc 2.31, 2.36 and 2.41 (Debian 11, 12 and 13 images,
en_US.utf8) the recorded version differed and the 9,463-string corpus and all 259,934 code points from U+00A0 to U+3FFFF, taken one at a time, sorted identically; indexes were clean (CD01, CD02, CD04). Between glibc 2.27 and 2.36 (Ubuntu 18.04 to Debian 12) keys that differ only in punctuation or a space reordered (CD02, CD04). - When the order did change, an index built under the old library gave wrong answers while a sequential scan with a sort gave right ones: 6,000 to 8,216 of 9,000 equality lookups missed through the index on the four arms and databases that changed order, and a unique index admitted 1,200 to 1,734 of 1,800 duplicate re-inserts (CD02).
bt_index_checkandbt_index_parent_checkraisedXX002in every wrong case and passed in every clean case, in all three runs (CD02).2ALTER DATABASE ... REFRESH COLLATION VERSIONrecorded the new version and removed the connect warning, and left the index files, the wrong lookups and the duplicate admission exactly as they were.ALTER COLLATION ... REFRESH VERSIONdid the same for an explicit collation. OnlyREINDEXreturned the counts to 0 (CD03).1- A physical standby on a newer image warned while its primary did not,
ALTER DATABASEfailed on it with25006, andREINDEXplus a refresh on the old-image primary did not change the standby’s results. Moving the primary to the new image and repairing there did (CD06). - The three supabase/postgres builds measured (17.6.1.141, 17.11.0.004, 17.11.0.018) all report glibc 2.40, ICU 75.1 and collation version 153.121, so no pair of them drifts (CD01, CD04). Each backend maps its glibc and locale archive from the Nix store inside the image (CD04).
Which do I pick
Section titled “Which do I pick”| Situation | Choice | Why |
|---|---|---|
| The connect warning appears and you do not know whether the order changed | Run bt_index_check with heapallindexed on the text indexes before touching the record | Flagged every wrong case and passed every clean case in CD02; the version string alone predicted neither (CD04) |
amcheck raises XX002 on a non-unique text index | REINDEX, then the refresh | REINDEX returned 0 violations and 0 missed lookups on every wrong arm (CD03) |
amcheck raises XX002 on a unique text index | Find and remove the duplicates, then REINDEX, then the refresh | REINDEX of the unique index failed 23505 while duplicates existed (CD02) |
| amcheck is clean and the warning stays | Refresh, accepting that clean means “no violation found in these indexes” | The refresh only records a version (CD03); a string shape no probe tried is not ruled out (CD04) |
Explicit collations in use (an index or column with COLLATE) | Refresh the database and each explicit collation | The database refresh left pg_collation at the old version (CD03) |
| A standby warns and its primary does not | Move the primary to the new image, repair there, let it replicate | The refresh fails on a standby, and maintenance on the old-image primary does not move the standby’s results (CD06) |
The same flow as text:
- A connection warns that the database’s recorded collation version differs from the library’s.
- Run
bt_index_checkwithheapallindexedon the indexes over text columns. - If any raises
XX002, remove duplicates from unique indexes first, thenREINDEXthe index. - Run the database refresh, and the collation refresh for each explicit collation in use.
- If none raised, go straight to step 4, knowing that the refresh records the version and verifies nothing.
What the warning says
Section titled “What the warning says”On the first connection to a database whose recorded version differs from the computed one, B’s server sent this (verbatim from the artifact, arm deb11-deb12, libc database; the numbers are the recorded and the computed version):
WARNING: database "cd_libc" has a collation version mismatchDETAIL: The database was created using collation version 2.31, but the operating system provides version 2.36.HINT: Rebuild all objects in this database that use the default collation and run ALTER DATABASE cd_libc REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.The ICU database gives the same text with 153.14 and 153.120. An explicit collation raises its own warning on first use in a session:
WARNING: collation "en_US.utf8" has version mismatchDETAIL: The collation in the database was created using version 2.31, but the operating system provides version 2.36.HINT: Rebuild all objects affected by this collation and run ALTER COLLATION pg_catalog."en_US.utf8" REFRESH VERSION, or build PostgreSQL with the right library version.CD01 counted the warnings per statement on each differing arm, with every statement on its own new connection:
| What ran | Warnings |
|---|---|
| First connection to the database | 1 on every arm whose versions differ; 0 on both supabase arms |
| Later statements on the default collation (a point lookup through the index, an ORDER BY, CREATE INDEX, DROP INDEX) | 0 after the connect warning |
| A bare comparison, or a lookup through the index, using the explicit collation | 1 each, on every differing arm |
postgres and template1 of the same cluster | 1 each: each database has its own recorded version (the supabase arms’ ICU databases read 153.121 and 153.121 and did not warn) |
B’s server log, lines database "cd_libc" has a collation version mismatch after the probe | 7, all from client backends, one per connection the module opened; for cd_icu 8, 7 client backends and 1 autovacuum worker. 0 and 0 on the supabase arms |
The collation version strings are not ordered by library version. ICU 60.2 reads 153.80, 67.1 reads 153.14, 72.1 reads 153.120, 75.1 reads 153.121 and 76.1 reads 153.128, so a larger number does not mean a newer library and the difference between two numbers says nothing about the size of the change.
The arms
Section titled “The arms”Each arm is a pair of images sharing one data directory. The library versions are read from the running backend (CD01), not assumed from the tag.
| Arm | Image A | Image B | glibc | ICU (collation version) | What else changes |
|---|---|---|---|---|---|
deb11-deb12 | postgres:17-bullseye (17.5, created 2025-06-06) | postgres:17-bookworm (17.12) | 2.31 to 2.36 | 67.1 to 72.1 (153.14 to 153.120) | Postgres minor 17.5 to 17.12 |
deb12-deb13 | postgres:17-bookworm (17.12) | postgres:17-trixie (17.12) | 2.36 to 2.41 | 72.1 to 76.1 (153.120 to 153.128) | nothing |
ubu1804-deb12 | Ubuntu 18.04 with PGDG 15.3, built locally | postgres:15-bookworm (15.20) | 2.27 to 2.36 | 60.2 to 72.1 (153.80 to 153.120) | Postgres minor 15.3 to 15.20 |
sb176-sb1711 | supabase/postgres 17.6.1.141 | supabase/postgres 17.11.0.004 | 2.40 to 2.40 | 75.1 to 75.1 (153.121) | nothing measured |
sb1711-sb1711b | supabase/postgres 17.11.0.004 | supabase/postgres 17.11.0.018 | 2.40 to 2.40 | 75.1 to 75.1 (153.121) | nothing measured |
Each cluster holds two databases created from template0, one libc (en_US.utf8) and one ICU (en-US), each with a text fixture and btree indexes. Every claim is read two ways: through the index (sequential scans and sorts disabled, the plan recorded) and by a sequential scan and sort, which call the comparison directly and do not read the index.
The arms were chosen after a library search with sort on the host images and then re-measured in Postgres. glibc 2.31, 2.36 and 2.41 gave the same order for the 9,463-string corpus and for all 259,934 code points taken one at a time, so no Debian-image glibc pair among these three differs. The glibc 2.28 boundary (a major locale data update on 2018-08-01, which the PostgreSQL wiki lists among the affected situations for a standby on different locale data or a binary restore onto one)34 needs a glibc older than 2.28 under a Postgres that records a database collation version, and Ubuntu 18.04 with the archived 15.3 package from the PostgreSQL Global Development Group (PGDG) was the arm that crosses it. ICU differs in every Debian pair, by version string and by order of some code points.
Which changes alter the sort
Section titled “Which changes alter the sort”CD01 sorted the corpus and the code points on B against A and recorded which fixture groups changed side. A fixture group is a set of keys sharing a prefix that sorts before or after the plain letter prefix on A.
| Arm | libc corpus / code points | libc fixture groups that changed side | ICU corpus / code points | ICU code points that changed side |
|---|---|---|---|---|
deb11-deb12 | same / same | none | same / different | U+20C0, U+2E53 |
deb12-deb13 | same / same | none | same / different | U+20A7, U+20A8, U+1CC00 |
ubu1804-deb12 | different / different | the five prefixes k-, k_, k., k: and k plus a space | same / different | U+20C0, U+2E53 |
| both supabase arms | same / same | none | same / same | none |
ICU 67 to 72 and 60 to 72 move U+20C0 and U+2E53; ICU 72 to 76 moves U+20A7, U+20A8 and U+1CC00. Each arm observed which candidates changed side instead of trusting the list.
What an index does after the change
Section titled “What an index does after the change”Fixture: 9,000 keys in each of two tables t and u (6 prefix groups of 1,500 keys). t_bt is a btree on the default collation, t_expl a btree on the explicit collation, and u_uq a unique index on u. “Missed” counts keys of t whose equality lookup through the index returns no row; the same count by sequential scan was 0 in every case. “Order violations” are adjacent pairs out of order under B’s comparison when the index is read in order, so a swap of whole groups shows as a few boundaries. The duplicate probe re-inserts every 5th key of u, 1,800 attempts.
| Arm, database | Order violations via index (sort: 0) | Lookups missed of 9,000 (seq scan: 0) | amcheck | Duplicates admitted of 1,800 | REINDEX of t_bt, t_expl |
|---|---|---|---|---|---|
| deb11-deb12 libc | 0 | 0 | ok | 0 | ok, still clean |
| deb11-deb12 ICU | 2 | 6,000 | XX002 item order invariant violated (t_bt, t_expl, u_uq) | 1,200 | ok, clean |
| deb12-deb13 libc | 0 | 0 | ok | 0 | ok |
| deb12-deb13 ICU | 3 | 7,176 | XX002 | 1,500 | ok, clean |
| ubu1804-deb12 libc | 4,500 | 8,216 | XX002 (bt_index_parent_check: down-link lower bound invariant violated) | 1,734 | ok, clean |
| ubu1804-deb12 ICU | 2 | 6,000 | XX002 | 1,200 | ok, clean |
| both supabase arms, both providers | 0 | 0 | ok | 0 | ok |
On every arm and database the sequential scan with a sort was right, and the index was wrong exactly where a group had changed side. After the duplicates went in, REINDEX INDEX u_uq failed on the three ICU arms and the Ubuntu libc arm with ERR 23505: could not create unique index "u_uq" because the duplicate keys are in the table. Deleting the duplicates (keeping the first by ctid) and repeating the REINDEX succeeded and left 9,000 rows. bt_index_check and bt_index_parent_check on t_bt both raised XX002 in every wrong case and both passed in every clean case; the message differs on the Ubuntu libc arm. Statements all returned: no backend hung or needed cancelling in any run.
REFRESH COLLATION VERSION without REINDEX
Section titled “REFRESH COLLATION VERSION without REINDEX”CD03 started from CD02’s wrong state on the deb11-deb12, deb12-deb13 and ubu1804-deb12 arms (the supabase arms have nothing to refresh). Each cell reads order violations / lookups missed of 9,000 / amcheck. x0 is before; x1 after ALTER DATABASE ... REFRESH COLLATION VERSION; x2 after ALTER COLLATION ... REFRESH VERSION; x3 after REINDEX.
| Arm, database | x0 | x1 | x2 | x3 |
|---|---|---|---|---|
| deb11-deb12 libc | 0 / 0 / ok | 0 / 0 / ok | 0 / 0 / ok | 0 / 0 / ok |
| deb11-deb12 ICU | 2 / 6,000 / XX002 | 2 / 6,000 / XX002; 1,200 of 1,800 duplicates still admitted | 2 / 6,000 / XX002 | 0 / 0 / ok |
| deb12-deb13 ICU | 3 / 7,176 / XX002 | 3 / 7,176 / XX002; 1,500 duplicates admitted | 3 / 7,176 / XX002 | 0 / 0 / ok |
| ubu1804-deb12 libc | 4,500 / 8,216 / XX002 | 4,500 / 8,216 / XX002; 1,734 duplicates admitted | 4,500 / 8,216 / XX002 | 0 / 0 / ok |
| ubu1804-deb12 ICU | 2 / 6,000 / XX002 | 2 / 6,000 / XX002; 1,200 duplicates admitted | 2 / 6,000 / XX002 | 0 / 0 / ok |
The deb12-deb13 libc database matches the deb11-deb12 libc one with 2.36 to 2.41.
- The database refresh printed a
NOTICE(changing version from 2.31 to 2.36on deb11-deb12 libc; 153.14 to 153.120 on its ICU database), setdatcollversionequal to the computed version, and the next new connection received no warning. - It did not touch
pg_collation. The explicit collation still read the old version and still raised its first-use warning, untilALTER COLLATION ... REFRESH VERSIONran; then there were 0 warnings. - The relation file nodes of
t_bt,t_explandu_uqwere identical after both refreshes and different afterREINDEX: the refresh rewrote nothing. - Wherever x0 was wrong, x1 and x2 were exactly as wrong, and the unique index kept admitting duplicates. Where x0 was clean (the glibc 2.31 to 2.36 and 2.36 to 2.41 libc databases) the refresh was harmless, because nothing was wrong.
The PostgreSQL documentation says the same: the refresh “will update the system catalog to record the current collation version and will make the warning go away. Note that this does not actually check whether all affected objects have been rebuilt correctly.”1 The run measures the consequence of that sentence. No docs-versus-runtime disagreement turned up on this point, so nothing was filed upstream.
Version changes without sort changes
Section titled “Version changes without sort changes”CD04 asked whether a mismatch can be metadata only. Per arm and database, the class is “version differs, sort identical” when the corpus and code point sort are identical on A and B and no group changed side. A second table held 30,000 identifier-style keys with a unique index built on A: 15,000 “tie” keys (3,000 codes each written five ways differing only in punctuation or a space: AB-0001, AB 0001, AB.0001, AB_0001, AB0001) and 15,000 “distinct” keys such as user-<md5>, user_<md5>, SKU-00012-C.
| Arm, database | Recorded to computed | Class | Tie keys missed of 15,000 | Distinct keys missed of 15,000 | Order violations | amcheck | Duplicates admitted (1,500 attempts per kind) |
|---|---|---|---|---|---|---|---|
| deb11-deb12 libc | 2.31 to 2.36 | version differs, sort identical on the probes | 0 | 0 | 0 | ok | 0 |
| deb12-deb13 libc | 2.36 to 2.41 | version differs, sort identical on the probes | 0 | 0 | 0 | ok | 0 |
| ubu1804-deb12 libc | 2.27 to 2.36 | version differs, sort differs | 12,263 | 0 | 6,000 | XX002 | 1,279 tie, 0 distinct |
| deb11-deb12, deb12-deb13, ubu1804-deb12 ICU | 153.14 to 153.120, 153.120 to 153.128, 153.80 to 153.120 | version differs, sort differs (code points) | 0 | 0 | 0 | ok | 0 |
| both supabase arms, both providers | equal | version same | 0 | 0 | 0 | ok | 0 |
- A recorded version can differ with no sort change on every probe used: glibc 2.31 to 2.36 to 2.41, on PG (PostgreSQL) 17 and
en_US.utf8, with the identifier table behaving correctly on B (0 of 30,000 keys missed in the sampled lookups) and amcheck clean. “Identical on the probes” is not “identical”: the run cannot rule out a difference in a string shape the probes lack. - The same libc record (
2.27 to 2.36) came with 12,263 of 15,000 tie keys missed and an unusable unique index, while2.31 to 2.36came with none. On the Ubuntu arm damage was confined to keys that differ only in punctuation or spacing; the 15,000 distinct keys were unaffected. That fits glibcen_USignoring punctuation at the first comparison level in both versions and only the tie-break among otherwise equal keys changing. A one-offsortofuser-bb user_aa user-aa user_bb user.aa@example.com user-abprinteduser_aa user-aa user.aa@example.com user-ab user_bb user-bbon glibc 2.27 anduser-aa user_aa user.aa@example.com user-ab user-bb user_bbon 2.36. That check was run by hand and is not in an artifact, and the mechanism was not isolated further. - ICU changed its version string on all three Debian-library arms and the order of some code points too, yet the identifier fixture saw nothing: the moved code points do not occur in its keys. Whether an ICU change harms an index depends on whether its keys hold characters whose weights changed, which the version string cannot say.
CD04-synthetic, on one image (Debian 12, glibc 2.36):UPDATE pg_database SET datcollversion = '1.0'as the superuser succeeded; a new connection warnedcreated using collation version 1.0, but the operating system provides version 2.36; the corpus sort, the lookups and amcheck were unchanged; the refresh put 2.36 back and the next connection was silent. The warning compares two version strings and nothing else. An upgrade does not construct this state.
Where the supabase images get their glibc
Section titled “Where the supabase images get their glibc”A support claim says Postgres can report the bundled glibc version while the system one does the sorting, which would make a mismatch metadata only. CD04 read the three supabase images (same result on all three): the base OS (operating system) is Alpine 3.23 (musl loader /lib/ld-musl-aarch64.so.1; ldd reports musl), the backend maps glibc-2.40-66/lib/libc.so.6 and glibc-locales-2.40-66/lib/locale/locale-archive from the Nix store plus icu4c-75.1, and the reported versions are 2.40 and 153.121. The libc that answers gnu_get_libc_version and the locale archive that supplies en_US.utf8 carry the same glibc version, and neither is a system library. The image’s store also holds other glibc paths that the backend did not map (glibc-2.39-5, glibc-2.40-218 and icu4c-76.1 in 17.6.1.141 and 17.11.0.004; glibc-2.42-67 in 17.11.0.018); the only glibc directories found were in /nix/store, and no glibc elsewhere in the image was searched for. On the Debian and Ubuntu images the libc and the locale archive are the image’s own. This holds for these three arm64 images in Docker; the hosted fleet’s build, host and any extra library paths were not measured.
Architecture and standbys
Section titled “Architecture and standbys”CD05 compared postgres:17-bookworm as linux/arm64 and as linux/amd64 (emulated on the arm64 host, 300 rows per group, no timings). Both fresh clusters reported glibc 2.36 and ICU collation version 153.120 and sorted the 9,463-string corpus and the 259,934 code points identically (14 compared cells, 0 differ), through a different libc.so.6 path each. The data directory the arm64 image made, with indexes, started under the amd64 image and accepted connections: 0 connect warnings, no group changed side, 0 order violations, 0 missed lookups, and bt_index_check and bt_index_parent_check ok. This says nothing about a hosted replica across architectures, the supabase image on amd64, or native amd64 hardware.
CD06 built a Debian 12 primary (glibc 2.36, ICU 72.1) and a Debian 13 standby (glibc 2.41, ICU 76.1), both PG 17.12, with pg_basebackup -R -X stream, 6 groups of 600 keys (3,600 rows in t).
| Step | Result |
|---|---|
| Standby as built | Connections to both databases warn (2.36 to 2.41; 153.120 to 153.128). The same databases on the primary, still on the older image, raise no warning |
| Standby’s ICU database | 3 order violations, 2,790 of 3,600 lookups missed through the index, bt_index_check XX002. The libc database shows none |
bt_index_parent_check on the standby | cannot run: 55000: cannot acquire lock mode ShareLock on database objects while recovery is in progress |
ALTER DATABASE ... REFRESH COLLATION VERSION on the standby | 25006: cannot execute ALTER DATABASE in a read-only transaction |
REINDEX and the refresh on the old-image primary | succeeded and replicated; the standby’s warning stayed and the ICU database still read 3 violations, 2,790 missed, XX002 |
| Primary stopped and restarted on the new image, same data directory | warns on both databases and reads the same wrong results as the standby on the ICU database; REINDEX and the refresh there, replayed to the standby, cleared the standby’s warning (datcollversion 2.41 and 153.128) and gave 0 / 0 / ok on both databases |
The reason the old-image primary’s repair does not reach the standby is an inference from the unchanged standby results, not a separate probe: the rebuilt index is in the old library’s order and replicates as such, and the refresh on the primary records the primary’s own, equal, version.
Reading the record in SQL
Section titled “Reading the record in SQL”These points come from pg-analyser’s notes on the same record, checked on throwaway containers on 2026-12-03 and not from the lab experiment, so they carry no module id here.5
| Point | Note |
|---|---|
| NULL recorded version | means “not tracked” (Debian template0; PG 17’s default pseudo-collation, oid 100, always NULL), so a check needs recorded IS NOT NULL |
| Indexes on the database default collation | have no pg_depend row on it and are read from pg_index.indcollation |
Mismatched template1 | plain CREATE DATABASE fails; TEMPLATE template0 still works |
| Order of repair | bt_index_check, then REINDEX INDEX CONCURRENTLY, then the refresh |
| PG 14 | has neither datcollversion nor the database function |
What was not measured
Section titled “What was not measured”- Any hosted project, the hosted upgrade or restore procedure, and what the platform runs after an image bump.
- A supabase/postgres pair with a real library change. The three local builds are all glibc 2.40 and ICU 75.1; no other tag was pulled. The lab’s self-hosted-defaults experiment (SD11b) logged
NOTICE: changing version from 2.39 to 2.40from the self-hosted PG 15 to 17 upgrade script, with no reindex step, and did not check index validity afterwards (the prior-art ledger of the collation-drift RUNLOG records this; the self-hosted RUNLOG was not re-read for this page). - The supabase image on linux/amd64 and native amd64 hardware.
- Other index types (GIN, GiST, hash), partitioning on text, foreign keys on text, expression indexes,
REINDEX CONCURRENTLY, lock behaviour or timing of aREINDEXon a large table. - PostgreSQL 18 and later, the builtin provider, locales other than
en_USanden-US, and glibc releases other than 2.27, 2.31, 2.36, 2.40 and 2.41. - Logical replication, a standby on an older image than its primary, and replication lag under load.
- Reports of inserts spinning on CPU after such a change were not reproduced: no statement hung or needed cancelling on these fixtures.
Reading the numbers
Section titled “Reading the numbers”- Counts are per fixture: 9,000 keys per table in CD02 and CD03 (6 prefix groups of 1,500), 30,000 in CD04, 3,600 in CD06. A different key mix gives different counts; the direction (index wrong where a group changed side) is the finding.
- “Changed side” is a property of the fixture’s prefixes against the probes the lab chose. It is not a statement about which strings in a real schema are affected.
- The three runs agree in every cell. The vantage is one Docker Desktop VM shared with other work, so the figures carry no timings.
- Image digests are the identity of an arm; tags move.
postgres:17-bullseyeresolved to a 17.5 build on 2026-12-03, which is why the Debian 11 to 12 arm also changes the Postgres minor.
What to do about it
Section titled “What to do about it”| Practice | Evidence | Module |
|---|---|---|
| Read the connect warning as a prompt to check indexes, not as proof of damage | glibc 2.31 to 2.36 to 2.41 warned with 0 violations, 0 of 9,000 lookups missed and amcheck ok | CD01, CD04 |
| Do not infer the damage from how far the version moved | 2.27 to 2.36 missed 12,263 of 15,000 tie keys, 2.31 to 2.36 none; collation version strings are not ordered by library version | CD04, CD01 |
Run bt_index_check with heapallindexed on text indexes after an image change | XX002 in every wrong case and ok in every clean case in 3 of 3 runs; it cannot run bt_index_parent_check on a standby | CD02, CD06 |
| Do not run the refresh to clear the warning before the indexes are rebuilt | x1 and x2 left the same counts as x0; 1,200 to 1,734 of 1,800 duplicates still admitted afterwards | CD03 |
REINDEX the text indexes, then refresh | x3 read 0 / 0 / ok on every wrong arm after REINDEX; the file nodes changed | CD03 |
Delete duplicates before REINDEX of a unique text index | REINDEX INDEX u_uq failed 23505 on the three ICU arms and the Ubuntu libc arm while duplicates existed; after deleting them (keeping the first by ctid) it succeeded | CD02 |
| Refresh each explicit collation as well as the database | The database refresh left pg_collation at the old version and the first-use warning stayed until ALTER COLLATION ... REFRESH VERSION | CD03 |
| Repair a warning standby on its primary, after moving the primary to the new image | Refresh on the standby failed 25006; maintenance on the old-image primary left the standby at 3 violations and 2,790 missed (inference stated above) | CD06 |
| Expect punctuation-only ties to reorder across glibc 2.28 | Ubuntu 18.04 (glibc 2.27) to Debian 12 changed order for all five punctuation and space prefixes; the PostgreSQL wiki names 2.28 as a major locale data update | CD02 |
Reproducing
Section titled “Reproducing”The experiment is experiments/collation-drift in supabase-lab. It needs Docker with 8 GB for the VM and about 6 GB of images; the Ubuntu 18.04 image is built from lib/bionic-pg15.Dockerfile.
make probe # every module, 16 to 18 minutes per run, writes evidence/<ts>/make probe ONLY=CD01,CD02 CD_ARMS=deb11-deb12make facts # measurements of the newest run as markdownEvidence
Section titled “Evidence”| Claim | Status | How it was checked |
|---|---|---|
| Warning text, per-database record, one warning per connection, one per session for an explicit collation | measured, 5 arms, 3 runs | CD01, run A facts |
| Index wrong through the planner’s index path, right by sequential scan, where order changed | measured, 5 arms, 3 runs | CD02, same artifacts |
amcheck XX002 in every wrong case, ok in every clean case | measured | CD02, run B facts, run C facts |
| Refresh records the version and changes no file node or result | measured, 3 arms, 3 runs | CD03, same artifacts |
| Refresh “does not actually check whether all affected objects have been rebuilt correctly” | documented1; consistent with CD03 | doc-read 2026-12-03 |
| A mismatch with no sort change: glibc 2.31 to 2.36 to 2.41 | measured on the probes; not ruled out for other string shapes | CD04, 9,463 strings, 259,934 code points, 30,000 identifier keys |
| The supabase images’ glibc and locale archive are the bundled Nix-store ones | measured on 3 arm64 images in Docker; hosted fleet not measured | CD04 libs results |
| arm64 data directory starts under amd64 with no warning, no damage | measured, one run per arm, emulated amd64 | CD05 |
Standby warns, primary does not, refresh fails 25006, repair on the new-image primary works | measured, one arm, 3 runs; the old-image primary’s non-effect is an inference | CD06 |
| glibc 2.28 as a major locale data update | documented34 | doc-read 2026-12-03 |
| The points under Reading the record in SQL (Structured Query Language) | pg-analyser’s notes, not lab-measured5 | notes dated 2026-12-03 |
Modules
Section titled “Modules”| Module | Experiment | Test | Artifact |
|---|---|---|---|
| CD01 | collation-drift | cd01-mismatch-mechanics.ts | run-2026-12-03T06-39-46-298Z |
| CD02 | collation-drift | cd02-consequences.ts | run-2026-12-03T06-39-46-298Z |
| CD03 | collation-drift | cd03-refresh-version.ts | run-2026-12-03T06-39-46-298Z |
| CD04 | collation-drift | cd04-metadata-only.ts | run-2026-12-03T06-39-46-298Z |
| CD05 | collation-drift | cd05-architecture.ts | run-2026-12-03T06-39-46-298Z |
| CD06 | collation-drift | cd06-replica-skew.ts | run-2026-12-03T06-39-46-298Z |
Related docs
Section titled “Related docs”- pgmig, logical-replication migration scope and gates - its
doctorandupgrade doctorchecks read this same recorded version before a move. - Supabase major-version upgrade, end to end - the ltree and collation-provider changes that an upgrade carries, which is where an image change meets this record.
- Supabase read replicas - how a replica is built and what it blocks, beside CD06’s physical standby on a newer image.
- Postgres statistics counters - the other recorded values (
stats_reset,idx_scan) that say less than they appear to.
References
Section titled “References”-
PostgreSQL Global Development Group, “ALTER COLLATION,” PostgreSQL 17 Documentation. https://www.postgresql.org/docs/17/sql-altercollation.html ↩ ↩2 ↩3 ↩4
-
PostgreSQL Global Development Group, “amcheck - tools to verify table and index consistency,” PostgreSQL 17 Documentation. https://www.postgresql.org/docs/17/amcheck.html ↩
-
PostgreSQL Wiki, “Locale data changes.” https://wiki.postgresql.org/wiki/Locale_data_changes ↩ ↩2
-
GNU C Library project, “Release/2.28,” glibc Wiki. https://sourceware.org/glibc/wiki/Release/2.28 ↩ ↩2
-
pg-analyser, “AGENTS.md” (the 2026-12-03 additions, collation version drift), GitHub, commit 7fd0dc4. https://github.com/erfianugrah/pg-analyser/blob/7fd0dc4958964dc540a43c0ab47ba2696d5a18f2/AGENTS.md ↩ ↩2