Running sp_QuickieStore with @get_all_databases = 1 and @escape_brackets = 1 adds extra escapes to the query_text_search string.
ReeceGoding opened this issue · 3 comments
Version of the script
4.2.
What is the current behavior?
On a system with Query Store enabled on multiple non-system databases, run
EXEC sp_QuickieStore @get_all_databases = 1, @query_text_search = '[AnyStringStartingAndEndingWithSquareBrackets]', @escape_brackets = 1, @debug = 1;
Now look at the debug information in the debug table that has its first cell contain "procedure_parameters". It shows an interesting value in the "query_text_search" column. On a server with Query Store enabled on five non-system databases, the value in that cell is
%\\\\\[AnyStringStartingAndEndingWithSquareBrackets]\\\\\]%'
and on a server with twenty-three such databases, it shows the same, but with twenty-three \
s on each side.
I take this as a sign that @get_all_databases = 1
and @escape_brackets = 1
don't work well together.
Furthermore, @escape_brackets
does not appear in the readme on GitHub.
What is the expected behavior?
I presume that the number of \
shown in the cell in question should not be proportional to the number of non-system databases that have Query Store active.
Also, @escape_brackets
should appear in the readme on GitHub.
Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
I do not expect this to be version dependent.
Oh I think I know what’s happening. There’s likely a += assignment of the bracket. I’m not home right now, but that seems the most likely scenario.
I thought the same. I think I've got it figured out. I'll have a PR ready soon.
Closed via #381