Skip to content

V174/22615 fix raw sql member filter repository#22616

Open
idseefeld wants to merge 9 commits intoumbraco:mainfrom
idseefeld:v174/22615-fix-raw-sql-MemberFilterRepository
Open

V174/22615 fix raw sql member filter repository#22616
idseefeld wants to merge 9 commits intoumbraco:mainfrom
idseefeld:v174/22615-fix-raw-sql-MemberFilterRepository

Conversation

@idseefeld
Copy link
Copy Markdown
Contributor

This closes issue #22615

@AndyButland I know you thought this could be done in 17.5, but I double checked with the protected branch for release-17.4.0 and that already contains the raw sql without using ISqlSyntaxProvider escaping.

@github-actions
Copy link
Copy Markdown

Hi there @idseefeld, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@idseefeld idseefeld changed the base branch from release/17.4.0 to main April 27, 2026 09:43
@idseefeld idseefeld marked this pull request as ready for review April 27, 2026 09:45
Copilot AI review requested due to automatic review settings April 27, 2026 09:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses cross-database compatibility issues in MemberFilterRepository by removing provider-specific raw SQL identifier quoting and switching to ISqlSyntaxProvider for quoting/escaping, enabling the combined (content + external) member filter query to work on more database providers.

Changes:

  • Updated MemberFilterRepository UNION query SQL to use ISqlSyntaxProvider for quoting table/column/alias identifiers.
  • Standardized the UNION DTO column mappings to match new projected column names.
  • Exposed a few DTO table/column name constants so the repository can reference them when building quoted SQL.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberFilterRepository.cs Reworks raw SQL to quoted identifiers via ISqlSyntaxProvider; updates projection aliases and DTO mappings for the UNION result.
src/Umbraco.Infrastructure/Persistence/Dtos/MemberDto.cs Makes MemberDto.TableName public so it can be reused when building quoted SQL.
src/Umbraco.Infrastructure/Persistence/Dtos/Member2MemberGroupDto.cs Makes MemberGroupColumnName public for reuse in repository SQL.
src/Umbraco.Infrastructure/Persistence/Dtos/ExternalMember2MemberGroupDto.cs Makes MemberGroupColumnName public for reuse in repository SQL.

INNER JOIN [{Constants.DatabaseSchema.Tables.Node}] ctn ON ctn.[id] = ct.[contentTypeId]
INNER JOIN [cmsContentType] ctd ON ctd.[nodeId] = ctn.[id]");
n.{QCol(NodeDto.KeyColumnName)} AS {QName("key")},
m.{QCol("Email")},
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

MapOrderByColumn() can return a quoted email identifier for ORDER BY, and the UNION column names come from the first SELECT (content members). In BuildContentMemberSql, the email projection is currently m.Email without an alias, so the result column name will be Email (not email) and ORDER BY "email" will fail on case-sensitive/quoted identifier DBs (e.g. PostgreSQL). Alias the email projection to the same name used elsewhere (e.g. email) so the UNION output, DTO mapping, and ordering all align.

Suggested change
m.{QCol("Email")},
m.{QCol("Email")} AS {QName("email")},

Copilot uses AI. Check for mistakes.
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