-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow variable escaping for PostgreSQL scripts #9
Comments
I want to know if there is a way. So far, I only manage to pass any function or SP with this The whole code is this
|
For PostgreSQL you may also replace
But anyway, escaping would be very useful (this is a first thought of the programmer) |
Would be nice if you implement this feature, and maybe make it more general, by allowing end users to specify which symbols should be treated like variables. We have insert statements, that has text that contains '$ ' symbol and because of that it breaks migration. If I could to set variable symbol like '$#' or '$$' (e.g. Can be done by setting VariableSubstitutionSqlParser.VariableDelimiter in derived class |
Duplicate of #1 as far as I can tell |
If SQL script contains something like
$BODY$
(used in postgresql to create functions), exception happens:Upgrade failed due to an unexpected exception: System.InvalidOperationException: Variable BODY has no value defined at DbUp.Engine.Preprocessors.VariableSubstitutionSqlParser.<>c__DisplayClass3_0.<ReplaceVariables>b__1(String name) at DbUp.Support.SqlParser.Parse() at DbUp.Engine.Preprocessors.VariableSubstitutionSqlParser.ReplaceVariables(IDictionary2 variables) at DbUp.Engine.Preprocessors.VariableSubstitutionPreprocessor.Process(String contents) at DbUp.Support.ScriptExecutor.PreprocessScriptContents(SqlScript script, IDictionary2 variables) at DbUp.Support.ScriptExecutor.Execute(SqlScript script, IDictionary2 variables) at DbUp.Engine.UpgradeEngine.PerformUpgrade()
SQL script is like this:
CREATE FUNCTION public.fn_something( b_id integer) RETURNS integer LANGUAGE 'plpgsql' COST 100 VOLATILE PARALLEL UNSAFE AS $BODY$ BEGIN RETURN ( select count(*) as something from sometable where id=b_id); END $BODY$;
Any other idea than renaming
$BODY$
to something which will not be picked up as variable?The text was updated successfully, but these errors were encountered: