Skip to content

Conversation

@llali
Copy link
Member

@llali llali commented Dec 12, 2025

Sync commits for release 170.147.0

GitOps (Git LowPriv) and others added 7 commits December 12, 2025 08:57
… ADD CONSTRAINT

# Pull Request Template for ScriptDom
## Description

GitHub bug: #125

RESUMABLE is valid for 160+
reference: https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver17#resumable---on--off

Max_Duration is valid for 120+
Reference: https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver17#max_duration--time--minutes-

Before submitting your pull request, please ensure you have completed the following:

## Code Change
- [ ] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed
- [ ] Code changes are accompanied by appropriate unit tests
- [ ] Identified and included SMEs needed to review code changes
- [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code

## Testing
- [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature

## Documentation
- [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file

## Additional Information
Please provide any additional information that might be helpful for the reviewers

Adding support for option RESUMABLE in ALTER TABLE ADD CONSTRAINT

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix that enables the RESUMABLE option in ALTER TABLE ADD CONSTRAINT through version-based validation updates and enhanced accompanying documentation and tests.

#### PR Summary
This PR introduces version-gated logic to allow RESUMABLE (and MAX_DURATION) only when the SQL Server version supports it, and updates related tests and documentation to clearly guide such validation fixes.
- Updated `/SqlScriptDom/Parser/TSql/TSql80ParserBaseInternal.cs` to replace unconditional option rejections with checks using version flags (TSql160AndAbove and TSql120AndAbove).
- Added new test scripts and baselines in `/Test/SqlDom/TestScripts/AlterTableResumableTests160.sql` and `/Test/SqlDom/Baselines160/AlterTableResumableTests160.sql`, and updated `/Test/SqlDom/Only160SyntaxTests.cs` to verify version-specific error counts.
- Added comprehensive documentation in new files (e.g., `/.github/VALIDATION_FIX_GUIDE.md`, `/.github/DEBUGGING_WORKFLOW.md`, and `/.github/README.md`) to assist users in handling validation issues like this.
- Updated copilot and bug fixing guides (in `/.github/copilot-instructions.md` and `/.github/BUG_FIXING_GUIDE.md`) with decision trees and pract...
…ETURN statement

# Pull Request Template for ScriptDom
## Description
Fixing bug #181

Before submitting your pull request, please ensure you have completed the following:

## Code Change
- [ ] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed
- [ ] Code changes are accompanied by appropriate unit tests
- [ ] Identified and included SMEs needed to review code changes
- [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code

## Testing
- [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature

## Documentation
- [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file

## Additional Information
Please provide any additional information that might be helpful for the reviewers

Fixing the bug JSON_OBJECT does not parse inside RETURN statement

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix and documentation update to ensure JSON_OBJECT (and related JSON functions) parse correctly inside RETURN statements.

#### PR Summary
This pull request fixes the issue where JSON_OBJECT was failing in RETURN statements by introducing token-based syntactic predicates across multiple grammar files, and it also adds supporting test cases and comprehensive documentation updates for testing and function extension in SqlScriptDOM.
- `SqlScriptDom/Parser/TSql/TSql160.g`, `TSql170.g`, and `TSqlFabricDW.g`: Added new `jsonObjectCall` and `jsonArrayCall` rules with proper syntactic predicates.
- `Test/SqlDom/TestScripts` and `Test/SqlDom/Baselines160`: Introduced new tests and baselines for JSON_OBJECT, JSON_ARRAY, and TRIM usage in RETURN statements.
- `/.github/instructions` and `/.github/prompts`: Added detailed guidelines for testing, new system function implementation, and grammar extension patterns.
- `Test/SqlDom/Only160SyntaxTests.cs` and `/.github/copilot-instructions.md`: Updated test configurations and documentation references to include the new JSON function tests.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
# Pull Request Template for ScriptDom
## Description

- Adding prompt files to run in VScode github copilot and it help developers with using the copilot to generate the code.
- Adding more instructions files for new features
- Fixing the test library to write enough info for copilot to know better how to fix the tests.

Before submitting your pull request, please ensure you have completed the following:

## Code Change
- [ ] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed
- [ ] Code changes are accompanied by appropriate unit tests
- [ ] Identified and included SMEs needed to review code changes
- [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code

## Testing
- [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature

## Documentation
- [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file

## Additional Information
Please provide any additional information that might be helpful for the reviewers

Adding prompts to help developer using github copilot

----
#### AI description  (iteration 1)
#### PR Classification
This pull request introduces new guides and prompts for developers as well as updates testing and documentation instructions.

#### PR Summary
This PR adds detailed guidelines for adding new index and data types, a new feature implementation prompt to assist GitHub Copilot users, and updates testing and documentation instructions throughout the repository.
- Added new guideline files: `/.github/instructions/new_index_types.guidelines.instructions.md` and `/.github/instructions/new_data_types.guidelines.instructions.md` with step‑by‑step instructions.
- Introduced a new prompt file `/.github/prompts/new-feature-implementation.prompt.md` to guide feature type identification for developers.
- Updated testing guidance in `/.github/instructions/testing.guidelines.instructions.md` and refactored ParserTest constructors to use nullable error counts.
- Modified copilot instructions and README links to reflect renamed and relocated guidelines.
- Made minor changes in test utilities and baseline test files to support these updates.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
…lumn references (GitHub issue #175)

## Issue
Users reported that `JSON_OBJECTAGG` was not parsing correctly with TSql170Parser, receiving the error &quot;Incorrect syntax near &#39;:&#39;&quot;.

Example that was failing:
```sql
SELECT JSON_OBJECTAGG( t.c1 : t.c2 )
FROM (
    VALUES(&#39;key1&#39;, &#39;c&#39;), (&#39;key2&#39;, &#39;b&#39;), (&#39;key3&#39;,&#39;a&#39;)
) AS t(c1, c2);
```

## Investigation Results
After thorough analysis, I found that **the grammar for JSON_OBJECTAGG is already complete and correct** in `SqlScriptDom/Parser/TSql/TSql170.g`. All supporting code exists:

- ✅ Grammar rules in TSql170.g (lines 32584, 33029-30, 33135)
- ✅ `jsonKeyValueExpression` rule handles both shorthand and explicit colon syntax
- ✅ `CodeGenerationSupporter.JsonObjectAgg` constant defined
- ✅ `JsonKeyValue` AST class with proper properties
- ✅ Script generator visitor for JsonKeyValue
- ✅ Comprehensive positive tests in `JsonFunctionTests170.sql`
- ✅ Comprehensive negative tests in `ParserErrorsTests.cs`

## Root Cause
The issue is that the **parser needs to be regenerated** from the grammar files via the build process. The grammar has the correct implementation, but the generated parser code needs to be updated.

## Changes Made
Added a test case to `JsonFunctionTests170.sql` that exactly matches the reported issue scenario:
- **Test script**: Added test with qualified column names `t.c1 : t.c2`
- **Baseline**: Added expected normalized output

This ensures future builds will include this specific test case and the parser will handle qualified column references in JSON_OBJECTAGG correctly.

## Next Steps
When the build runs, it will:
1. Regenerate the parser from TSql170.g using ANTLR
2. Compile the updated parser
3. Run all tests (which should pass)
4. Publish a new NuGet package with the working parser

## Verification
The fix can be verified with:
```csharp
var script = @&quot;SELECT JSON_OBJECTAGG( t.c1 : t.c2 )
FROM (
    VALUES(&#39;key1&#39;, &#39;c&#39;), (&#39;key2&#39;, &#39;b&#39;), (&#39;key3&#39;,&#39;a&#39;)
) AS t(c1, c2);&quot;;

var parser = new TSql170Parser(true);
var fragment = parser.Parse(new StringReader(script), out var parseErrors);

Assert.AreEqual(0, parseErrors.Count); // Should pass after build
```

Fixes: [scriptdom is missing json_objectagg](https://msdata.visualstudio.com/web/wi.aspx?pcguid=8b119ea1-2e2a-4839-8db7-8c9e8d50f6fa&amp;id=4792111)

<p><small class=\"secondary-text\">AI-generated content may be incorrect</small></p>

<!-- GitOpsUserAgent=GitOps.Apps.Server.copilotswe -->
Co-authored-by: Azure Pipelines Test Service <>
Co-authored-by: GitHub Copilot <>
Co-authored-by: Leila Lali <llali@microsoft.com>

Related work items: #4792111
# Pull Request Template for ScriptDom
## Description
Please provide a detailed description, include the link to the design specification or SQL feature document for the new TSQL syntaxes. Make sure to add links to the Github or DevDiv issue

Before submitting your pull request, please ensure you have completed the following:

## Code Change
- [ ] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed
- [ ] Code changes are accompanied by appropriate unit tests
- [ ] Identified and included SMEs needed to review code changes
- [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code

## Testing
- [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature

## Documentation
- [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file

## Additional Information
Please provide any additional information that might be helpful for the reviewers

----
#### AI description  (iteration 1)
#### PR Classification
This PR introduces new automation prompts and demo instructions for ADO commit analysis and T-SQL verification, along with updates to testing guidelines and configuration adjustments.

#### PR Summary
The changes add detailed prompts and demonstration files to automate the analysis of ADO commits (including VECTOR_SEARCH validation and bug reporting), update testing instructions and guidelines to enforce unit test best practices, and adjust ADO configuration settings.
- **`.github/prompts/analyze-ado-commit-for-tsql-verification.prompt.md`**: New prompt outlining the complete workflow for analyzing ADO commits for T-SQL verification and creating bug reports.
- **`.github/demo/analyze_ado_commit_demo.md` & `.github/demo/new-feature-implementation_demo.md`**: Demo files showcasing the automated analysis process and the implementation fix for the VECTOR_SEARCH function (supporting 3-part identifiers).
- **`.github/prompts/verify-and-test-tsql-syntax.prompt.md`**: Updated prompt with enhanced debugging and unit test instructions for verifying T-SQL syntax.
- **Guideline Instruction Updates (`.github/instructions/*`)**: Revised testing, bug fixing, and function guidelines to mandate unit test usage and align testing procedures.
- **`.vscode/mcp.json`**: Modified ADO configuration with an updated area path for proper integration.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Adding Release notes for 170.147.0
@llali llali merged commit ab77781 into main Dec 12, 2025
8 checks passed
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.

4 participants