-
-
Notifications
You must be signed in to change notification settings - Fork 200
Open
Description
I'm sync'ing from SQL Server (SqlSyncChangeTrackingProvider) to PostgreSql (NpgsqlSyncProvider).
A table I'm trying to sync includes a "float" type column:
The table does not exist in pgsql, and when DMS attempts to create it, it throws this error:
PostgresException: 42704: type "double" does not exist
From what I can tell the error comes NpgsqlDbMetadata.GetCompatibleColumnTypeDeclarationString which seems to stringify the enum value as it exists in NpgsqlTypes.NpgsqlDbType, which returns "double". But it should be float8 or "double precision".
A quick fix would be to add the Double entry to the switch case and add "precision" as the argument value. Kinda wonky, but it works:
switch (sqlDbType)
{
case NpgsqlDbType.Varbit:
case NpgsqlDbType.Varchar:
case NpgsqlDbType.Char:
// case NpgsqlDbType.Text:
argument = column.MaxLength > 0 ? $"({column.MaxLength})" : string.Empty;
break;
case NpgsqlDbType.Numeric:
var (p, s) = this.GetPrecisionAndScale(column);
if (column.DbType == (int)DbType.Single && column.Precision == 0 && column.Scale == 0)
argument = $"({PRECISIONMAX}, 8)";
else if (p > 0 && s <= 0)
argument = $"({p})";
else if (p > 0 && s > 0)
argument = $"({p}, {s})";
break;
case NpgsqlDbType.Double:
argument = "precision";
break;
default:
argument = string.Empty;
break;
}
Metadata
Metadata
Assignees
Labels
No labels