Skip to content

Commit

Permalink
0005381: allow cast to inet type in Postgres (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
clloydaccanto committed Aug 3, 2022
1 parent e7abf85 commit 79278b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Expand Up @@ -131,6 +131,7 @@ public abstract class TypeMap {
public static final String TSVECTOR = "TSVECTOR";
public static final String JSONB = "JSONB";
public static final String JSON = "JSON";
public static final String INET = "INET";
/** Maps type names to the corresponding {@link java.sql.Types} constants. */
private static HashMap<String, Integer> _typeNameToTypeCode = new HashMap<String, Integer>();
/** Maps {@link java.sql.Types} type code constants to the corresponding type names. */
Expand Down
Expand Up @@ -161,6 +161,8 @@ private String getTypeToCast(Column column) {
typeToCast = "json";
} else if (column.getJdbcTypeName() != null && column.getJdbcTypeName().toUpperCase().contains(TypeMap.JSON)) {
typeToCast = "json";
} else if (column.getJdbcTypeName() != null && column.getJdbcTypeName().toUpperCase().contains(TypeMap.INET)) {
typeToCast = "inet";
}
if (typeToCast != null && column.getMappedType() != null && column.getMappedType().equals(TypeMap.ARRAY)) {
typeToCast = typeToCast + "[]";
Expand Down

0 comments on commit 79278b2

Please sign in to comment.