Skip to content

Column data type validation not quite exact #1895

Open
@abrunetta

Description

@abrunetta

With a PostgreSql database, when I run a schema validation the following happens:

  • Property mapped as timestamp against a timestamptz column => Schema Validation Failed (as expected)
  • Property mapped as timestamptz against a timestamp column => Schema Validation OK (not as expected)

After checking the repository code, I found where the error might be: src/NHibernate/Mapping/Table.cs, method ValidateColumns:

bool typesMatch = 
    column
        .GetSqlType(dialect, mapping)
        .StartsWith(columnInfo.TypeName, StringComparison.OrdinalIgnoreCase);

Is it correct to check if both types match (mapping and column) with .StartsWith(...)?
Wouldn't be better to use .Equals(...) here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions