V174/22615 fix raw sql member filter repository#22616
V174/22615 fix raw sql member filter repository#22616idseefeld wants to merge 9 commits intoumbraco:mainfrom
Conversation
|
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:
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 🤖 🙂 |
There was a problem hiding this comment.
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
MemberFilterRepositoryUNION query SQL to useISqlSyntaxProviderfor 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")}, |
There was a problem hiding this comment.
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.
| m.{QCol("Email")}, | |
| m.{QCol("Email")} AS {QName("email")}, |
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
ISqlSyntaxProviderescaping.