Skip to content

Apply PK and update-operation policy predicates to DWSQL upsert UPDATE statement#3719

Closed
souvikghosh04 wants to merge 5 commits into
mainfrom
dwsql-upsert-update-policy-predicates
Closed

Apply PK and update-operation policy predicates to DWSQL upsert UPDATE statement#3719
souvikghosh04 wants to merge 5 commits into
mainfrom
dwsql-upsert-update-policy-predicates

Conversation

@souvikghosh04

Copy link
Copy Markdown
Contributor

Summary

Aligns the DWSQL query builder's upsert (PUT) UPDATE branch with the MsSql and PostgreSQL builders by including the primary-key predicate and the update-operation database policy in the generated WHERE clause.

Change

  • DwSqlQueryBuilder.Build(SqlUpsertQueryStructure) now joins the PK predicate with GetDbPolicyForOperation(Update) and appends it as the UPDATE ... WHERE clause, matching the existing MsSqlQueryBuilder behavior.

Follow-up

  • DWSQL REST upsert does not yet return the affected-record result set and has no dedicated PUT test class; response wiring and integration test coverage will be added in a separate change.

…E statement

Aligns the DWSQL query builder's upsert (PUT) UPDATE branch with the MsSql and PostgreSQL builders by including the primary-key predicate and the update-operation database policy in the generated WHERE clause.
Verifies the DwSql upsert UPDATE branch includes the primary-key predicate and the update-operation database policy in its WHERE clause. Runs without a live database via a mocked metadata provider.

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

This PR aligns DWSQL upsert (PUT) query generation with the MsSql/PostgreSQL builders by ensuring the UPDATE branch is constrained by both the primary-key predicate and the update-operation database policy predicate in the generated WHERE clause, preventing table-wide updates and enforcing row-level authorization.

Changes:

  • Update DwSqlQueryBuilder.Build(SqlUpsertQueryStructure) to append WHERE <PK predicates AND update-policy predicate> to the upsert UPDATE statement.
  • Add a DWSQL upsert unit test to validate the UPDATE branch includes PK predicates and the update-policy predicate.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Core/Resolvers/DWSqlQueryBuilder.cs Adds PK + update-policy predicate joining and applies it to the upsert UPDATE statement WHERE clause.
src/Service.Tests/UnitTests/DwSqlQueryBuilderUnitTests.cs Adds unit test coverage for DWSQL upsert UPDATE branch predicate enforcement (PK + update policy).

Comment thread src/Core/Resolvers/DWSqlQueryBuilder.cs Outdated
Comment thread src/Service.Tests/UnitTests/DwSqlQueryBuilderUnitTests.cs Outdated
souvikghosh04 and others added 3 commits July 14, 2026 16:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@souvikghosh04 souvikghosh04 self-assigned this Jul 14, 2026
@souvikghosh04 souvikghosh04 added this to the July 2026 milestone Jul 14, 2026
@souvikghosh04 souvikghosh04 moved this from Todo to Review In Progress in Data API builder Jul 14, 2026
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Data API builder Jul 14, 2026
@souvikghosh04 souvikghosh04 deleted the dwsql-upsert-update-policy-predicates branch July 14, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants