Skip to content

Make Oracle integration tests run and fix Oracle single statement execution code#2126

Merged
jzabroski merged 2 commits into
fluentmigrator:mainfrom
PhenX:feature/oracle-integration-tests
Aug 28, 2025
Merged

Make Oracle integration tests run and fix Oracle single statement execution code#2126
jzabroski merged 2 commits into
fluentmigrator:mainfrom
PhenX:feature/oracle-integration-tests

Conversation

@PhenX

@PhenX PhenX commented Aug 25, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@PhenX
PhenX marked this pull request as ready for review August 26, 2025 06:27
@PhenX
PhenX requested a review from jzabroski as a code owner August 26, 2025 06:27
/// <summary>
/// Splits a SQL script into individual statements, taking into account Oracle-specific syntax rules.
/// </summary>
private static List<string> SplitOracleSqlStatements(string sqlScript)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I just noticed (again) the existence of SemicolonSearcher, SqlBatchParser etc, I should use it, what do you think ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I tried to use it (with the same implementation as SnowflakeBatchParser) but it seems that it matches semicolons inside "ranges", in my case : strings 🫠
I'm too afraid to change it 😨

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am not a big fan of the batch parser. sql is a very complicated dialect

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oh I think I understood ... My string spans multiple lines (I'm in the long string tests for Oracle)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I am not a big fan of the batch parser. sql is a very complicated dialect

Yeah, neither am I, but it still a lot better than the Regex previously used

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The simplest regex would be if the line ends in a ;\s*$

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

how to handle strings spaning multiple lines, containing a semicolon ? I'm sure the batch parser could be solid, but it needs to handle "ranges" spanning multiple lines, which it does not ATM.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I finally gave up on using the SqlBatchParser, its handling of ranges line-by-line seems broken

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

my regex hack makes it so long as the last non whitespace character on a line is a ; , it will treat it as a separator.

return false;
}

if (_keywords.Contains(name))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why not just always quote identifiers?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because it would be too breaking. Quoted identifiers in Oracle become case sensitive 🙃
Needless to say it breaks everything

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Got it. I would put that in a separate PR though with a separate issue, right? Because currently we're already in case sensitive behavior, which I can see as non-desirable. We would need to list that in the release notes as a breaking change to move to case sensitive by default. We may also want a way to easily allow forcing case sensitive identifiers to maintain backward compatibility, right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Why not, but without it the integration tests on Oracle won't work, or I ignore them for now ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ok, can you create a separate Issue and I will put it in the 7.2 milestone. I think GitHub will just generate release notes correctly.

@PhenX PhenX Aug 26, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

/// <inheritdoc />
public override IList<string> DatabaseTypeAliases { get; } = new List<string>()
{ "Oracle-12c-Manager", "Oracle 12c Managed", "Oracle Managed", "Oracle" };
{ "Oracle-12c-Managed", "Oracle 12c Managed", "Oracle Managed", "Oracle" };

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

😰

/// <summary>
/// Splits a SQL script into individual statements, taking into account Oracle-specific syntax rules.
/// </summary>
private static List<string> SplitOracleSqlStatements(string sqlScript)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am not a big fan of the batch parser. sql is a very complicated dialect

@jzabroski
jzabroski merged commit edbbae9 into fluentmigrator:main Aug 28, 2025
@jzabroski jzabroski added this to the 7.2.0 milestone Aug 28, 2025
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.

3 participants