Skip to content

test: range_pruning's twin picks its collation the way the shell does (#1341) - #1532

Merged
jdatcmd merged 1 commit into
mainfrom
test/1341-range-pruning-collation
Oct 17, 2026
Merged

jdatcmd merged 1 commit into
mainfrom
test/1341-range-pruning-collation

Conversation

@jdatcmd

@jdatcmd jdatcmd commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

The follow-up I promised on #1529, for #1341: the range_pruning twin now picks its collation the way the shell does.

Note 1: the collation choice

The twin listed candidates from pg_collation, in catalog order and with ICU filtered out. On an en_US.UTF-8 host, the #1529 review found the twin choosing C where the shell chose ucs_basic (their measurement, not repeated here). And on a host where only unicode discriminates, it would decline while the shell ran.

It now tries the shell's five candidates in the shell's order, each asked directly with ('B' < 'a' COLLATE c) <> ('B' < 'a'). A collation that doesn't exist, or an ICU one in a build without ICU, raises. _q turns that into query_error(), which is never True, so the next candidate is tried. The connection is autocommit, so a failed candidate poisons nothing.

Note 2: I left it, and here's why

I said I'd make test_a_discriminating_collation_was_found check that the twin chose the shell's first discriminating candidate. With the fixture now running the shell's own procedure, that check would recompute the same answer the same way, so it couldn't fail either. The shell records this name only as its SKIP, and the twin declines it on the same hosts the shell skips it on. That is the parity the name can carry, so the test stays as it is.

Checks

  • PG17: 34 passed.
  • compare_to_bash.py: every bash property covered.
  • Guards: 442.

This is a twin-only change: no ledger or registry change.

🤖 Generated with Claude Code

…#1341)

The twin listed candidates from pg_collation, in catalog order and
without ICU, so on some hosts it chose a different collation from the
shell, and on a host where only an ICU collation discriminates it would
decline while the shell ran (#1529 review). It now tries the shell's
five candidates in the shell's order, each asked directly; a missing or
unsupported one becomes a query_error() and the next is tried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@OffgridwithJD OffgridwithJD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdatcmd Approved at 5171bb88.

  • PG17: twin 34 passed, shell 33/33 on the same tree; compare_to_bash.py covers every bash property.
  • Matches the shell: the five candidates en_US.utf8, en_GB.utf8, unicode, ucs_basic, C are the shell's, in its order (range_pruning.sh:263), with the same probe ('B' < 'a' COLLATE "<c>") <> ('B' < 'a'). is True corresponds to the shell's = "t", and both stop at the first match and skip on none.
  • Measured on an ICU build: en_US f, en_GB f, unicode f, ucs_basic t, C t, so both pick ucs_basic.
  • A missing collation is safe: collation "nonexistent_coll" for encoding "UTF8" does not exist comes back as a query_error() string, never True, so the next candidate is tried. The connection stays idle and the later candidates answer normally.

I agree with your note 2: with the fixture running the shell's own procedure, a "chose the shell's candidate" check would recompute the same answer.

🤖 Generated with Claude Code

@jdatcmd
jdatcmd merged commit 3f646ee into main Oct 17, 2026
15 checks passed
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