Fixed Issue #3325 - #3349
Fixed Issue #3325#3349Hydrocharged wants to merge 1 commit into
Conversation
|
SummaryCoverage spans fixed-width character handling across comparisons, ordering, casting, formatting, joins, grouping, indexing, uniqueness, concurrency, and null safety, along with contrasting variable-length text behavior. It exercises normal flows, boundary cases involving padding and meaningful spaces, and adversarial cases such as concurrent inserts and null inputs, with healthy results throughout. Safe to merge — the run found no regressions, new failures, or previously flagged failures attributable to this PR, and the broad behavior coverage passed. No merge-blocking risk was identified. Tests run by Ito
Tip Reply with @itoqa to send us feedback on this test run. |
|
|
@Hydrocharged DOLT
|
zachmu
left a comment
There was a problem hiding this comment.
Mostly looks good, but confirm how postgres handles other non-space whitespace characters for these cases and add tests for them.
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return strings.TrimRight(str, " "), nil |
There was a problem hiding this comment.
Is this the right character set to trim? What about other whitespace chars like tabs and newlines?
| Name: "Issue #3325: trailing spaces of a bpchar value are ignored", | ||
| SetUpScript: []string{ | ||
| "CREATE TABLE t3325 (id INT PRIMARY KEY, c CHAR(2) CHECK (c::text IN ('L', 'R')));", | ||
| "INSERT INTO t3325 VALUES (1, 'L'), (2, 'R ');", |
There was a problem hiding this comment.
This should be an assertion, not part of the setup
| }, | ||
| Assertions: []ScriptTestAssertion{ | ||
| { | ||
| Query: "SELECT '[' || 'L'::CHAR(2) || ']', length('L'::CHAR(2)), 'L'::CHAR(2) = 'L', 'L '::CHAR(2) = 'L'::CHAR(2), 'L'::CHAR(2)::TEXT = 'L', 'L'::CHAR(2)::VARCHAR = 'L', bpcharcmp('L'::CHAR(2), 'L ');", |
There was a problem hiding this comment.
This is a good test, but we should also have a test case which is an exact match of the queries in the original issue. This is close but misses some, e.g. it doesn't directly select 'L '::character(2), it only tests it for equality.
| case string: | ||
| bb := v2.(string) | ||
| if t.ID == BpChar.ID { | ||
| ab = strings.TrimRight(ab, " ") |
There was a problem hiding this comment.
Same comment about other whitespace chars. What does postgres do?

Fixes #3325.
Stacked on #3348.