Skip to content

Commit

Permalink
0004113: Postgres Time column type can't be converted to Timestamp
Browse files Browse the repository at this point in the history
column type without a cast when restoring the data
  • Loading branch information
philipmarzullo64 committed Oct 14, 2019
1 parent ecf2ccc commit 827395b
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -280,6 +280,18 @@ public String getSelectLastIdentityValues(Table table) {
return result.toString();
}
}

@Override
protected void writeCastExpression(Column sourceColumn, Column targetColumn, StringBuilder ddl) {
if(sourceColumn != null && sourceColumn.getMappedTypeCode() == Types.TIME &&
targetColumn != null && targetColumn.getMappedTypeCode() == Types.TIMESTAMP)
{
ddl.append("date_trunc('DAY', localtimestamp) + ");
printIdentifier(getColumnName(sourceColumn), ddl);
} else {
super.writeCastExpression(sourceColumn, targetColumn, ddl);
}
}

@Override
protected void processTableStructureChanges(Database currentModel, Database desiredModel,
Expand Down

0 comments on commit 827395b

Please sign in to comment.