Implement string.Trim with parameters on SQL Server

Open
#22,927 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, sql
Domain
databases

Research direction

No files or tests are named; start by locating the SQL Server string.Trim translation and its query translation tests. Verify that non-whitespace characters use SQL Server's TRIM syntax while whitespace-only trimming remains compatible with older versions, then update or add coverage for the generated SQL.

Written by the indexing model from the issue text.

Description

area-query area-sqlserver

We currently translate string.Trim only when no characters are specified (whitespace only), and implement it with LTRIM/RTRIM.

SQL Server 2017 introduced a more fully-featured TRIM function which can accept characters to trim. To maintain compatibility with older versions we can still use this only when non-whitespace characters are specified. Unfortunately no similar overloads exist for LTRIM/RTRIM (#22924).

Note that TRIM has a funky syntax (TRIM ( [ characters FROM ] string )), instead of just commas.

Dominant language
C#
Stars
14.8k
Forks
3.4k
Avg merge
2d 5h
Merged PRs (30d)
134

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/efcore

All issues in dotnet/efcore

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.