microsoft / microsoft/sqlmanagementobjects

Using .Databases with a misspelled database name changes database name in SMO

オープン
#115 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
143
フォーク
28
PR マージ指標
30日以内にマージされた PR はありません

説明

This bug was found using dbatools: https://github.com/dataplat/dbatools/issues/8598

There are two ways to select a single database from the list of databases from a Microsoft.SqlServer.Management.Smo.Server object: $server.Databases | Where-Object Name -EQ <dbname> and $server['<dbname>'].

The first one works without problems. But the second one changes the casing of the name from the original one to the one used to query the database.

Here is the code to show that:

Import-Module -Name dbatools

# correct:
$server = [Microsoft.SqlServer.Management.Smo.Server]::new('sql01')
$server.Databases | Where-Object Name -EQ Master | Select-Object -ExpandProperty Name
$server.Databases['Master'] | Select-Object -ExpandProperty Name

# wrong:
$server = [Microsoft.SqlServer.Management.Smo.Server]::new('sql01')
$server.Databases['Master'] | Select-Object -ExpandProperty Name
$server.Databases | Where-Object Name -EQ Master | Select-Object -ExpandProperty Name

And here is a screenshot:

image

Yes, I'm using not the current version - but I don't have the current version at hand. But I think it will take you only minutes to test this in your test environment. If it is fixed with the current version: Sorry to bother you.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、Server.Databases とその文字列インデクサーを使用した PowerShell の例で動作を再現します。次に、Databases コレクションの検索処理の実装を追跡し、大文字と小文字が異なるクエリ、またはスペルミスのあるクエリに対するリグレッションテストのカバレッジを追加します。データベースをクエリしても、元のデータベース名やその大文字と小文字が変更されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, powershell
領域
databases
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。