Skip to content

Fix quick search collation issues by splitting UNION queries#68

Merged
alex-bochkov merged 4 commits intosql-searchfrom
codex/remove-union-all-from-searchdatabase
Feb 14, 2026
Merged

Fix quick search collation issues by splitting UNION queries#68
alex-bochkov merged 4 commits intosql-searchfrom
codex/remove-union-all-from-searchdatabase

Conversation

@alex-bochkov
Copy link
Copy Markdown
Contributor

Motivation

  • The quick-search implementation used a single large UNION ALL query across metadata views which can trigger collation conflicts on some SQL Server configurations.
  • Running the separate metadata queries independently avoids SQL Server trying to reconcile differing collations during runtime while returning the same aggregate results.

Description

  • Replaced the single multi-section sql string in SearchDatabaseAsync with three separate queries: definitionSql, tableSql, and columnAndParameterSql.
  • Added a new helper ExecuteSearchQueryAsync that executes a provided SQL batch with shared parameters and merges all returned result sets into an aggregate DataTable using DataTable.Merge.
  • Updated SearchDatabaseAsync to open a single SqlConnection and invoke ExecuteSearchQueryAsync for each query to preserve results while avoiding UNION ALL across different metadata sources.
  • Preserved parameter handling (@pattern, @includeProcs, @includeViews, @includeFunctions, @includeTables) and set command timeout to 120 seconds in the new helper.

Testing

  • Committed the change and verified the diff locally with git (commit created: "Fix quick search collation issues by splitting UNION queries").
  • Attempted to build with dotnet build AxialSqlTools.sln, but the build could not run in this environment because the .NET SDK is not available (dotnet: command not found).
  • No automated unit/integration tests were executed due to the unavailable .NET toolchain in the current environment.

Codex Task

@alex-bochkov alex-bochkov merged commit 5a8e71b into sql-search Feb 14, 2026
@alex-bochkov alex-bochkov deleted the codex/remove-union-all-from-searchdatabase branch February 14, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant