DarlingData icon indicating copy to clipboard operation
DarlingData copied to clipboard

sp_QuickieStore: @execution_type_desc is un-validated.

Open ReeceGoding opened this issue 1 year ago • 1 comments

Version of the script All versions, I bet.

What is the current behavior? You can type whatever you want in to @execution_type_desc and sp_QuickieStore will take it as a valid choice.

If the current behavior is a bug, please provide the steps to reproduce. Run sp_QuickieStore @execution_type_desc = 'foobar'. The nonsense argument will get you no rows, but also no warnings or errors. This is unlike our other enum-like parameters, such as @sort_order.

What is the expected behavior? Validate the input (the valid values are documented here), then, if the user inputs an invalid value, either throw an error and fail or print a message and use a sensible default instead. The choice is Erik's.

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures? All versions, I bet.

IMPORTANT: If you're going to contribute code, please read the contributing guide first. https://github.com/erikdarlingdata/DarlingData/blob/main/CONTRIBUTING.md Again? Sure.

ReeceGoding avatar Oct 28 '24 14:10 ReeceGoding

@ReeceGoding good call on this. I totally missed it. This one should probably throw an error and re-print acceptable options.

erikdarlingdata avatar Oct 28 '24 14:10 erikdarlingdata

Closed via #494

erikdarlingdata avatar Nov 09 '24 16:11 erikdarlingdata