Skip to content

Migrations: Fix raw SQL with ISqlSyntaxProvider table and column quoting (closes #22603)#22604

Merged
AndyButland merged 10 commits into
umbraco:mainfrom
idseefeld:v174/22603-fix-raw-sql
Apr 28, 2026
Merged

Migrations: Fix raw SQL with ISqlSyntaxProvider table and column quoting (closes #22603)#22604
AndyButland merged 10 commits into
umbraco:mainfrom
idseefeld:v174/22603-fix-raw-sql

Conversation

@idseefeld

@idseefeld idseefeld commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

This closes issue #22603

Details will be provided by Copilot😉

@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 marked this pull request as ready for review April 24, 2026 20:57
Copilot AI review requested due to automatic review settings April 24, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates an existing V_17_4_0 upgrade migration to correctly escape table/column identifiers in its raw SQL using ISqlSyntaxProvider, improving compatibility with database providers where unescaped identifiers can break statements (issue #22603).

Changes:

  • Pull ISqlSyntaxProvider from database.SqlContext.SqlSyntax inside the migration.
  • Quote table and column names in the raw UPDATE statement via GetQuotedTableName() / GetQuotedColumnName().

@idseefeld idseefeld marked this pull request as draft April 24, 2026 21:03
@idseefeld idseefeld marked this pull request as ready for review April 24, 2026 21:36
@AndyButland

Copy link
Copy Markdown
Contributor

As we've built 17.4 for internal testing now @idseefeld, I'd like to not merge anything else into it unless it's something specifically broken since 17.3. Looks to me the migration fix in this PR matches that case, but I don't think the MemberFilterRepository changes does. Do you think you could separate this PR into two please - one for 17.4 that just has the minimal changes to fix the migration and one for existing concerns for 17.5 please?

Obviously we need to try to get better to remember quoting the column names. I'll try to keep a better eye on this moving forward.

@idseefeld idseefeld marked this pull request as draft April 27, 2026 08:28
@idseefeld

Copy link
Copy Markdown
Contributor Author

@AndyButland I'll separate this PR as you suggested.
Indeed it would be helpful when you could have an eye on raw sql updates too.

@idseefeld idseefeld marked this pull request as ready for review April 27, 2026 08:52

@AndyButland AndyButland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @idseefeld - fix looks correct to me having carefully checked over all the replacements.

@AndyButland AndyButland changed the title Fix Raw Sql with ISqlSyntaxProvider Name Escaping (closes #22603) Migrations: Fix raw SQL with ISqlSyntaxProvider table and column quoting (closes #22603) Apr 28, 2026
@AndyButland AndyButland enabled auto-merge (squash) April 28, 2026 08:13
@AndyButland AndyButland merged commit 122e1a9 into umbraco:main Apr 28, 2026
28 checks passed
AndyButland added a commit that referenced this pull request Apr 28, 2026
…oting (closes #22603) (#22604)

* fix raw sql with ISqlSyntaxProvider name escaping

* reduce hard coded strings

* Fix Raw Sql in MemberFilterRepository

* fix formating

* restore MemberFilterRepository

* Correct usage of field name constant.

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants