Invoke-DbaQuery - Document what -As SingleValue really returns - #10727
Merged
Merged
Conversation
The help said SingleValue returns "the first column of the first row". The code expands the first column of every row of the first result set, so several rows come back as an array, no row returns $null, a NULL value is System.DBNull, and further columns and result sets are dropped silently. Measured on 2026-09-20 with dbatools 2.9.0. (do Invoke-DbaQuery) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
andreasjordan
marked this pull request as ready for review
September 20, 2026 09:35
potatoqualitee
approved these changes
Sep 21, 2026
potatoqualitee
left a comment
Member
There was a problem hiding this comment.
Reviewed the complete help-only patch at this exact head against the actual SingleValue expansion behavior, surrounding source/tests, discussions, parse equivalence, and passing CI. The corrected wording accurately describes all first-column values. No material defects found.
Member
|
thank you 馃檹馃徏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The help of
Invoke-DbaQuerydescribes-As SingleValueas "the first column of the first row". The code inInvoke-DbaAsyncdoes$ds.Tables[0] | Select-Object -ExpandProperty <first column>, which returns the first column of every row of the first result set. Measured on 2026-09-20 with dbatools 2.9.0 on PowerShell 7.6.3 against SQL Server 2025:SELECT COUNT(*) FROM sys.databasesSystem.Int32SELECT name FROM sys.databases(4 rows)System.Object[]with all 4 names, no warningSELECT DB_NAME(1) AS a, DB_NAME(2) AS ba, columnbdropped, no warningsp_BlitzFirst @SinceStartup = 1(4 result sets)SELECT CAST(NULL AS nvarchar(10))System.DBNull, not$nullSELECT ... WHERE 1 = 0$null, no warningThis PR only changes the help text (
.PARAMETER Asand.OUTPUTS) to say what the command does. No code or test changes. If the behavior itself should change to match the old wording, that is a separate decision.Test plan
Get-Help Invoke-DbaQuery -Parameter Asshows the new sentencecreated by Claude and reviewed by Andreas Jordan
馃 Generated with Claude Code