dataplat / dbops

⚙ dbops - Powershell module that provides continuous database deployments on any scale
MIT License
155 stars 39 forks source link

$ character in SQL text breaks the deployment #121

Closed piroinno closed 3 years ago

piroinno commented 3 years ago

We have observed that when we inject '$' into the SQL text and execute deploy.ps1 it fails with the following error:

[12:15:16][deploy.ps1] System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near 'master'. Incorrect syntax near 'master'. Incorrect syntax near ') BEGIN RAISERROR ('. Incorrect syntax near '?'. Incorrect syntax near 'master'. Incorrect syntax near ') BEGIN RAISERROR ('. Incorrect syntax near '?'. Incorrect syntax near ') BEGIN RAISERROR ('. Incorrect syntax near 'master'. Incorrect syntax near ') BEGIN RAISERROR ('. Incorrect syntax near '?'. Incorrect syntax near 'master'. Incorrect syntax near ') BEGIN RAISERROR ('. Incorrect syntax near '?'. Incorrect syntax near 'END'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at DbUp.Support.ScriptExecutor.ExecuteAndLogOutput(IDbCommand command) at DbUp.SqlServer.SqlScriptExecutor.ExecuteCommandsWithinExceptionHandler(Int32 index, SqlScript script, Action excuteCommand) ClientConnectionId:3fc63250-120c-4dcf-9e82-a961206db174 Error Number:102,State:1,Class:15

nvarscar commented 3 years ago

I cannot reproduce on my end, could you please share more details?

nvarscar commented 3 years ago

I'm closing this one for now. Feel free to re-open it if the issue persists.