Skip to content
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

fix: change default character delimiter for Variable Substitution #795

Closed
wants to merge 1 commit into from

Conversation

ebellani
Copy link

closes DbUp/dbup-postgresql#22

This is a backwards incompatible change and would require a major version bump, imho.

@gukiboy
Copy link

gukiboy commented Jun 21, 2024

Can you think of a way of making this optional? Like, allowing the user to use one or the other as the delimiter, based on setup. This would not break compatibility.

@ebellani
Copy link
Author

ebellani commented Jun 21, 2024

Can you think of a way of making this optional? Like, allowing the user to use one or the other as the delimiter, based on setup. This would not break compatibility.

There is already a way of changing this via inheritance. My suggestion with this PR is that it is the wrong default, easily breaking a the interaction with a major DBMS

@ebellani
Copy link
Author

ebellani commented Jul 5, 2024

@JakeGinnivan @droyad bump?

@fuzzybair
Copy link

Any chance of getting this fix? We do not use Variable Substitution with DbUp but not being able to create a schema with Stored Procedures is a problem. https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING

@@ -26,7 +26,7 @@ public VariableSubstitutionSqlParser(string sqlText, string delimiter = "GO", bo
/// Delimiter character for variables.
/// Defaults to `$` but can be overridden in derived classes.
/// </summary>
protected virtual char VariableDelimiter => '$';
protected virtual char VariableDelimiter => '!';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this have a similar issue parsing SQL that uses a C style != for example SELECT * FROM task WHERE status != 'Done';

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think !=! is a valid SQL statement

@droyad
Copy link
Member

droyad commented Sep 30, 2024

This is a non-obvious breaking change. I think there is too much code out there that depends on that delimiter. We may consider a PostgreSQL specific solution.

@droyad droyad closed this Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The default character for Variable Substitution clashes with a common PostgreSQL idiom
4 participants