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

WIP Fix validating similar but not equal column types #2997

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

hazzik
Copy link
Member

@hazzik hazzik commented Jan 18, 2022

Just fixes similar column types checks for precision and scale is not implemented, because:

From @fredericDelaporte:

Validating length/scale/precision when available should be done as an improvement, with a dedicated PR.

Fixes #1895

@@ -1035,7 +1036,10 @@ public IEnumerable<string> ValidateColumns(Dialect.Dialect dialect, IMapping map
}

//TODO: Add new method to ColumnMetadata :getTypeCode
bool typesMatch = column.GetSqlType(dialect, mapping).StartsWith(columnInfo.TypeName, StringComparison.OrdinalIgnoreCase);
Copy link
Member

Choose a reason for hiding this comment

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

Why not simply check that next char is not a letter (char.IsLetter)?

Copy link
Member Author

@hazzik hazzik Jan 18, 2022

Choose a reason for hiding this comment

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

I was/am thinking about that. Even have code about to push. But it is not that simple.

is not a letter

Oracle is pouncing with (n)varchar/(n)varchar2...

Copy link
Member

Choose a reason for hiding this comment

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

Still see no reasons to use regex - check additionally for not a digit (char.IsDigit). Alphanumeric character check should suffice

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I hate the regex myself. But that is not that easy really. For example, Db2's CHAR(16) FOR BIT DATA would match to CHAR(16) even in my implementation with regex.

@hazzik hazzik changed the title Fix validating similar but not equal column types WIP Fix validating similar but not equal column types Sep 8, 2022
@hazzik hazzik closed this Oct 5, 2022
@hazzik hazzik deleted the gh1895 branch October 5, 2022 08:27
@hazzik hazzik restored the gh1895 branch October 5, 2022 08:46
@hazzik hazzik reopened this Oct 5, 2022
@hazzik hazzik removed this from the 5.4 milestone Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Column data type validation not quite exact
3 participants