Skip to content

sql: implement binary collation check and expression coercibility res… - #3817

Open
elianddb wants to merge 4 commits into
mainfrom
elian/11380
Open

sql: implement binary collation check and expression coercibility res…#3817
elianddb wants to merge 4 commits into
mainfrom
elian/11380

Conversation

@elianddb

@elianddb elianddb commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

…olution
Fix dolthub/dolt#11380

@itoqa

itoqa Bot commented Sep 5, 2026

Copy link
Copy Markdown

Ito QA test results
Commit: 722da8b: 19 test cases ran, 19 passed ✅.

Summary

Coverage spans core text-function behavior, including left and right padding, Unicode and binary character handling, collation and precedence rules, NULL and invalid-input behavior, truncation, argument ordering, and concurrent session isolation. It includes normal flows, boundary and error cases, regression checks, and adversarial review of an expected coercibility concern.

Safe to merge — all exercised behaviors passed, and the only reported concern was determined to conflict with the intended collation rules rather than indicate a product defect. No PR-attributable regressions, new failures, or previously flagged failures remain.

Tests run by Ito

View full run

Result Severity Type Description
General LPAD and RPAD returned the requested number of characters without splitting accented letters or emoji. Both functions also kept their correct left and right padding behavior.
General LPAD and RPAD correctly repeat a multibyte pad and use a complete character for the partial remainder. The results have the requested length and keep padding on the correct side.
General The SQL engine returned the expected collation and coercibility for same-collation, unspecified, binary, and conflicting pairs. It also chose the lower-coercibility operand when the two values differed by one level.
General Nested text and padding operations returned the expected collation and character-length results. The browser error was expected because the local target speaks MySQL, not HTTP.
General Malformed padding input returned an error without showing partial output. The next valid padding calls returned the correct values.
General Padding keeps the left and right directions separate when called through the SQL registry. Truncation and NULL values also produce the expected results.
General LPAD and RPAD keep the source, length, and pad arguments in the right roles after scalar-subquery rewrites. Direct and rewritten SQL returned the same left/right padding, NULL values, and invalid-length error.
General Two independent SQL sessions ran conflicting collation queries 100 times each. Both sessions returned the expected value and metadata every time, with no results leaking between sessions.
Collation LPAD and RPAD returned the source string collation and coercibility values expected by the SQL engine.
Functions CONCAT, CONCAT_WS, ELT, FIELD, REPLACE, LPAD, and RPAD returned their expected results in focused unit tests and the SQL engine integration suite.
Functions Padding returns NULL when the source, length, or pad value is NULL, and it reports an error when the length cannot be converted to a number.
Functions Concatenation, selection, comparison, and replacement with mixed text values returned the expected results and collation metadata. Equivalent nested expressions matched the direct expressions, and the focused Go tests passed.
Padding LPAD and RPAD added multibyte padding on the correct side and truncated the source at complete characters. The local SQL checks and the focused regression tests passed.
Padding LPAD and RPAD return empty strings for a zero length and SQL NULL for negative or NULL lengths. The focused regression tests also pass for both functions.
Resolution The resolver returned the expected collation and coercibility for lower-precedence values, unspecified operands, explicit conflicts, binary collations, and incompatible character sets.
Rev Binary padding returned the expected byte sequences. Truncating C3A9 to one byte returned C3, and padding 41 with C3A9 returned 41C3A9C3 without a malformed-string error.
Rev A latin1 column kept its collation through both padding functions. The left-padded value was xxxé, the right-padded value was éxxx, and the padded value had four characters.
Rev Verified acceptable by independent adversarial review: the reported expectation does not match what the code actually promises. Review notes: The finding's decisive premise, that a CONCAT of two differently and explicitly collated operands must itself have coercibility 0, conflicts with the repository's explicit aggregation contract and test: a conflict between equal-strength explicit collations yields CoercibilityNone (1). For the stated expression, the static call path is CollatedExpression (0 for each operand) through CONCAT's reduce…
Rev NULL inputs return NULL, and an empty pad returns an empty string when more characters are requested.

Tip

Reply with @itoqa to send us feedback on this test run.

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.

RPAD()/LPAD() has unexpected behvior

1 participant