Skip to content
Permalink
Browse files

0003846: Postgres error column type tsvector but expression is of type

character varying
  • Loading branch information...
erilong committed Jan 8, 2019
1 parent 6ae809a commit 302f952d54036e1542493caf51af459f5545e8ae
@@ -117,7 +117,8 @@
public static final String NCLOB = "NCLOB";
public static final String IMAGE = "IMAGE";
public static final String DATETIME2 = "DATETIME2";

public static final String TSVECTOR = "TSVECTOR";

/** Maps type names to the corresponding {@link java.sql.Types} constants. */
private static HashMap<String, Integer> _typeNameToTypeCode = new HashMap<String, Integer>();

@@ -125,6 +125,8 @@ protected void appendColumnParameter(StringBuilder sql, Column column) {
column.getJdbcTypeName().toUpperCase().contains(TypeMap.GEOMETRY) ||
column.getJdbcTypeName().toUpperCase().contains(TypeMap.GEOGRAPHY))) {
sql.append("ST_GEOMFROMTEXT(?)").append(",");
} else if (column.getJdbcTypeName().toUpperCase().contains(TypeMap.TSVECTOR)) {
sql.append("cast(? as tsvector)").append(",");
} else {
super.appendColumnParameter(sql, column);
}
@@ -148,6 +150,8 @@ protected void appendColumnEquals(StringBuilder sql, Column column) {
column.getJdbcTypeName().toUpperCase().contains(TypeMap.GEOGRAPHY)) {
sql.append(quote).append(column.getName()).append(quote)
.append(" = ST_GEOMFROMTEXT(?)");
} else if (column.getJdbcTypeName().toUpperCase().contains(TypeMap.TSVECTOR)) {
sql.append(quote).append(column.getName()).append(quote).append(" = cast(? as tsvector)");
} else {
super.appendColumnEquals(sql, column);
}

0 comments on commit 302f952

Please sign in to comment.
You can’t perform that action at this time.