[fix](doc) dev: backport 4.x string-function example expansions and corner-case adds (en+zh)#3848
Merged
morningman merged 1 commit intoMay 30, 2026
Conversation
…orner-case adds (en+zh) Mechanical port of the 4.x fixes in apache#3833, apache#3837, apache#3838, apache#3839 to dev/master. * strleft.md ZH (apache#3837) — already without the redundant example on dev, skipped. * milliseconds-add.md EN BIGINT-range example (apache#3834) — already in dev, skipped (the ZH duplicate-removal + expected- output fix is in the sibling PR). Files changed: EN (docs/sql-manual/sql-functions/scalar-functions/string-functions/): * from-base64.md, instr.md, length.md, locate.md, lpad.md — backport the corner-case examples (NULL / empty / multi-byte UTF-8 / numeric / etc.) added in 4.x apache#3833. * rtrim.md — add the LENGTH-based 'default-only-strips-ASCII-space' example that exposes the (intentional) behavior gap with \t and \n (4.x apache#3837). * substring.md — add the corner case 'empty source string' example that 4.x had but dev never did, plus the 'NULL passed directly' example added in 4.x apache#3839. * trim.md — replace example 2's prose + expected output with the version that says 'trim repeatedly strips from both ends', matching cluster behavior (`trim('ababccaab', 'ab') = 'cca'` not `'ababcca'`). Plus the UTF-8 multi-byte-pattern example from 4.x apache#3839. EN (docs/sql-manual/sql-functions/scalar-functions/other-functions/): * field.md — replace the page with the 4.x post-apache#3789 + apache#3839 version: adds CREATE TABLE setup for `baseall` and `class_test` (which the page references but never created), adds a NULL row to the `class_test` data, adds DESC and NULLS FIRST examples that exercise NULL handling under custom FIELD ordering. ZH (i18n/zh-CN/.../current/): * field.md — add the simple `SELECT FIELD(2, 3, 1, 2, 5)` example that introduces the 1-based-index semantics before the ORDER BY use case. * ltrim.md — rewrite example 3 ('多种空白字符处理') so its expected output matches reality: by default LTRIM only strips ASCII space, not \t / \n, so the result still contains the tab and newline. Switched to a LENGTH() comparison for clarity. * substring.md — add the SUBSTR alias example. * trim.md — add three examples (no-match returns original; repeated pattern strips until exhausted; asymmetric removal with multi-char pattern). Also drop a trailing ';;' typo. Verified end-to-end against today's master cluster — all added / modified examples behave identically on master and on 4.1.1 so the doc fixes apply unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mechanical port of the 4.x fixes in #3833, #3837, #3838, #3839 to dev/master. Verified against today's master build (selectdb-qa-test tarball).
Skipped (already applied on dev):
Files (13)
EN string-functions
trim('ababccaab', 'ab')iscca, notababcca— trim repeatedly strips from both ends), plus the UTF-8 multi-byte-pattern example ([fix](doc) trim/field/substring: bidirectional en/zh sync #3839)EN other-functions
baseallandclass_test(which the page references but never created), adds a NULL row toclass_test, adds DESC and NULLS FIRST examples that exercise NULL handling ([fix](doc) field.md: add missing setup; reconcile zh result tables with NULL row #3789 + [fix](doc) trim/field/substring: bidirectional en/zh sync #3839 combined)ZH
SELECT FIELD(2, 3, 1, 2, 5)example ([fix](doc) trim/field/substring: bidirectional en/zh sync #3839)\t/\n, so the result still contains the tab/newline. Switched to a LENGTH() comparison for clarity ([fix](doc) ltrim.md zh example 3: correct expected output (LTRIM does NOT strip \t / \n by default) #3838);;typo ([fix](doc) trim/field/substring: bidirectional en/zh sync #3839)Verification
Verified end-to-end against today's master cluster — all added / modified examples behave identically on master as on 4.1.1, so the doc fixes apply unchanged.
Related 4.x PRs
#3833 #3837 #3838 #3839 (and #3789 for the field.md setup blocks).
🤖 Generated with Claude Code