Google Chrome 59.0.3071.115
Ubuntu 17.04
PostgreSQL 9.6.3 on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit
- Metabase version: 0.25.1
- Metabase hosting environment: Docker
- Metabase internal database: H2
SELECT COUNT("order".order_id) AS sclr_0, TO_CHAR("order".created_at, 'YYYY-MM-DD') AS sclr_1 FROM "order" where {{created_at}} AND {{restaurant}} GROUP BY sclr_1;
restaurant variable -> Widget: id
ERROR: operator does not exist: integer = character varying Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 331
Logs
Jul 28 16:27:32 WARN metabase.query-processor :: {:status :failed,
:class java.lang.Exception,
:error «ERROR: operator does not exist: integer = character varyingn Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.n Position: 275»,
:stacktrace
[«driver.generic_sql.query_processor$do_with_try_catch.invokeStatic(query_processor.clj:349)»
«driver.generic_sql.query_processor$do_with_try_catch.invoke(query_processor.clj:345)»
«driver.generic_sql.query_processor$execute_query.invokeStatic(query_processor.clj:396)»
«driver.generic_sql.query_processor$execute_query.invoke(query_processor.clj:392)»
«driver$fn__22473$G__22466__22480.invoke(driver.clj:45)»
«query_processor$execute_query.invokeStatic(query_processor.clj:49)»
«query_processor$execute_query.invoke(query_processor.clj:43)»
«query_processor.middleware.mbql_to_native$mbql__GT_native$fn__26496.invoke(mbql_to_native.clj:30)»
«query_processor.middleware.annotate_and_sort$annotate_and_sort$fn__25019.invoke(annotate_and_sort.clj:41)»
«query_processor.middleware.limit$limit$fn__26451.invoke(limit.clj:14)»
«query_processor.middleware.cumulative_aggregations$cumulative_aggregation$fn__26299.invoke(cumulative_aggregations.clj:46)»
«query_processor.middleware.cumulative_aggregations$cumulative_aggregation$fn__26299.invoke(cumulative_aggregations.clj:46)»
«query_processor.middleware.format_rows$format_rows$fn__26442.invoke(format_rows.clj:21)»
«query_processor.middleware.results_metadata$record_and_return_metadata_BANG_$fn__27720.invoke(results_metadata.clj:88)»
«query_processor.middleware.resolve$resolve_middleware$fn__24627.invoke(resolve.clj:329)»
«query_processor.middleware.expand$expand_middleware$fn__26193.invoke(expand.clj:536)»
«query_processor.middleware.add_row_count_and_status$add_row_count_and_status$fn__24711.invoke(add_row_count_and_status.clj:14)»
«query_processor.middleware.driver_specific$process_query_in_context$fn__26319.invoke(driver_specific.clj:12)»
«query_processor.middleware.resolve_driver$resolve_driver$fn__27730.invoke(resolve_driver.clj:14)»
«query_processor.middleware.cache$maybe_return_cached_results$fn__25099.invoke(cache.clj:146)»
«query_processor.middleware.catch_exceptions$catch_exceptions$fn__26241.invoke(catch_exceptions.clj:58)»
«query_processor$process_query.invokeStatic(query_processor.clj:124)»
«query_processor$process_query.invoke(query_processor.clj:120)»
«query_processor$run_and_save_query_BANG_.invokeStatic(query_processor.clj:232)»
«query_processor$run_and_save_query_BANG_.invoke(query_processor.clj:227)»
«query_processor$fn__27764$process_query_and_save_execution_BANG___27769$fn__27770.invoke(query_processor.clj:270)»
«query_processor$fn__27764$process_query_and_save_execution_BANG___27769.invoke(query_processor.clj:256)»
«api.card$run_query_for_card.invokeStatic(card.clj:491)»
«api.card$run_query_for_card.doInvoke(card.clj:477)»
«api.card$fn__29925$fn__29928$fn__29929.invoke(card.clj:498)»
«api.card$fn__29925$fn__29928.invoke(card.clj:497)»
«api.common.internal$do_with_caught_api_exceptions.invokeStatic(internal.clj:227)»
«api.common.internal$do_with_caught_api_exceptions.invoke(internal.clj:222)»
«api.card$fn__29925.invokeStatic(card.clj:493)»
«api.card$fn__29925.invoke(card.clj:493)»
«middleware$enforce_authentication$fn__28955.invoke(middleware.clj:122)»
«api.routes$fn__40133.invokeStatic(routes.clj:56)»
«api.routes$fn__40133.invoke(routes.clj:56)»
«routes$fn__40784$fn__40785.doInvoke(routes.clj:75)»
«routes$fn__40784.invokeStatic(routes.clj:71)»
«routes$fn__40784.invoke(routes.clj:71)»
«middleware$log_api_call$fn__29054$fn__29056.invoke(middleware.clj:331)»
«middleware$log_api_call$fn__29054.invoke(middleware.clj:330)»
«middleware$add_security_headers$fn__29004.invoke(middleware.clj:245)»
«middleware$bind_current_user$fn__28959.invoke(middleware.clj:142)»
«middleware$maybe_set_site_url$fn__29008.invoke(middleware.clj:268)»],
:query
{:type «native»,
:native
{:query «SELECT COUNT(«order».order_id) AS sclr_0, TO_CHAR(«order».created_at, ‘YYYY-MM-DD’) ASnsclr_1 FROM «order» where {{created_at}} [[AND {{restaurant}}]]nGROUP BY sclr_1;»,
:template_tags
{:created_at
{:id «431f6a38-455e-db5e-d862-59d6903b3242», :name «created_at», :display_name «Created at», :type «dimension», :required true, :dimension [«field-id» 166], :widget_type «date/range»},
:restaurant {:id «66ad5e09-0957-d8e2-d85f-30cab586024a», :name «restaurant», :display_name «Restaurant», :type «dimension», :dimension [«field-id» 181], :widget_type «id»}}},
:constraints {:max-results 10000, :max-results-bare-rows 2000},
:parameters [{:type «id», :target [«dimension» [«template-tag» «restaurant»]], :value «6»}],
:cache_ttl nil,
:info
{:executed-by 1,
:context :question,
:card-id 3,
:dashboard-id nil,
:query-hash [-49, -69, -67, 38, 55, -79, -44, 54, 54, -72, -75, -20, 71, -14, 52, -66, -89, -106, -38, 7, 42, 16, 27, 25, 122, 123, 24, -84, 42, 71, -116, -126],
:query-type «native»}},
:expanded-query nil}
Jul 28 16:27:32 WARN metabase.query-processor :: Query failure: ERROR: operator does not exist: integer = character varying
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Position: 275
[«query_processor$assert_query_status_successful.invokeStatic(query_processor.clj:201)»
«query_processor$assert_query_status_successful.invoke(query_processor.clj:194)»
«query_processor$run_and_save_query_BANG_.invokeStatic(query_processor.clj:233)»
«query_processor$run_and_save_query_BANG_.invoke(query_processor.clj:227)»
«query_processor$fn__27764$process_query_and_save_execution_BANG___27769$fn__27770.invoke(query_processor.clj:270)»
«query_processor$fn__27764$process_query_and_save_execution_BANG___27769.invoke(query_processor.clj:256)»
«api.card$run_query_for_card.invokeStatic(card.clj:491)»
«api.card$run_query_for_card.doInvoke(card.clj:477)»
«api.card$fn__29925$fn__29928$fn__29929.invoke(card.clj:498)»
«api.card$fn__29925$fn__29928.invoke(card.clj:497)»
«api.common.internal$do_with_caught_api_exceptions.invokeStatic(internal.clj:227)»
«api.common.internal$do_with_caught_api_exceptions.invoke(internal.clj:222)»
«api.card$fn__29925.invokeStatic(card.clj:493)»
«api.card$fn__29925.invoke(card.clj:493)»
«middleware$enforce_authentication$fn__28955.invoke(middleware.clj:122)»
«api.routes$fn__40133.invokeStatic(routes.clj:56)»
«api.routes$fn__40133.invoke(routes.clj:56)»
«routes$fn__40784$fn__40785.doInvoke(routes.clj:75)»
«routes$fn__40784.invokeStatic(routes.clj:71)»
«routes$fn__40784.invoke(routes.clj:71)»
«middleware$log_api_call$fn__29054$fn__29056.invoke(middleware.clj:331)»
«middleware$log_api_call$fn__29054.invoke(middleware.clj:330)»
«middleware$add_security_headers$fn__29004.invoke(middleware.clj:245)»
«middleware$bind_current_user$fn__28959.invoke(middleware.clj:142)»
«middleware$maybe_set_site_url$fn__29008.invoke(middleware.clj:268)»]
The error org.postgresql.util.PSQLException: ERROR: operator does not exist: my_enum_type = character varying can be fixed by using implicit conversions in PostgreSQL or using explicit conversions by passing the java.sql.Types.OTHER to Spring JDBC.
The exception you will receive
When using Spring JDBC or Spring Data JDBC and custom Java enum types, you might run into the following problem:
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT * FROM your_table where enum_column = :enum_value;] nested exception is org.postgresql.util.PSQLException: ERROR: operator does not exist: my_enum_type = character varying Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
The exception can occur if you are having enums with either
- or you are trying to persist an Spring Data JDBC entity with a repository save method
- executing a query on your own with one of Spring JDBC’s jdbcTemplate methods like query
Making Spring Data JDBC’s save method work with enumerations
With Spring Data JDBC you have probably an SQL definition like
CREATE TYPE my_enum_type AS ENUM('VALUE_1','VALUE_2')
CREATE TABLE my_table (enum_column my_enum_type);
The belonging Java source code will look like
public enum MyEnumType {
VALUE_1, VALUE_2
}
@Table("my_table")
public class MyEntity {
private MyEnumType type;
// getter & setter ...
}
@Repository
public class MyTableRepository extends CrudRepository</* ... */> {
}
@Controller
public class MyTableController {
@Autowired
MyTableRepository
@GetMapping("/")
public void save() {
MyEntity entity = new MyEntity();
entity.setType(MyEnumType.VALUE_1);
repository.save(entity);
}
}
As soon as you try to call repository.save you will receive an exception. The problem is, that Spring Data JDBC does not support enumerations at the moment. See Jens Schauder’s answer at stackoverflow.
Jens does also link to another SO answer which describes how to solve the problem. To make the code sample above working, we can use PostgreSQL’s implicit conversion feature as described in the linked answer. The following SQL definition would reside somewhere in your Liquibase or Flyway migration definition:
<!-- Liquibase migration definition -->
<!-- as described above -->
<sql>CREATE TYPE my_enum_type AS ENUM('VALUE_1','VALUE_2')</sql>
<!-- add an additional type -->
<sql>CREATE CAST (varchar AS my_enum_type) WITH INOUT AS IMPLICIT</sql>
With help of the described CREATE CAST PostgreSQL will automatically try convert each String/varchar into the specified enum. You can now do something like
SELECT * FROM my_table WHERE enum_column = 'VALUE_1';
-- OR
INSERT INTO my_table(enum_column) VALUES('VALUE_1')
After that, repository.save() will work.
Using JdbcTemplate and enumerations
You might think that the specified CREATE CAST definition would also work for something like that:
public class MyRepository {
@Autowired
NamedParameterJdbcTemplate jdbcTemplate;
public List<String> findAll() {
MapSqlParameterSource parameters = new MapSqlParameterSource("type", MyEnumType.VALUE_1);
return jdbcTemplate
.queryForList("SELECT enum_column FROM my_table WHERE enum_column = :type", parameters);
}
}
But this will drive you right into the exception you find at the beginning:
org.postgresql.util.PSQLException: ERROR: operator does not exist: my_enum_type = character varying
The reason for this behavior is how PostgreSQL handles the type casts. This Stackoverflow answer describes the reasons in detail. Spring JDBC does automatically convert the enum value into a Java String type and assigns it to the prepared statement. The underlying PgJDBC drivers then assigns the java.sql.Type.VARCHAR as type for this prepared statement parameter. Due to the assignment of the java.sql.Type, PostgreSQL will no longer try to apply our CREATE CAST conversion.
Solving it by configuration
You can configure your JDBC URL to use the parameter stringtype with value undefined. Each String parameter previously set with setString() will then not have the type definition java.sql.Type.VARCHAR. PostgreSQL applies will then apply our CREATE CAST definition.
Solving it programatically
If you don’t globally want to set stringtype to undefined, you have to use the java.sql.Types.OTHER when adding a value to the MapSqlParameterSource:
// does NOT WORK:
// .addValue("type", MyEnumType.VALUE_1))
// one of the following does work:
.addValue("type", "VALUE_1", java.sql.Types.OTHER)
// or
.addValue("type", MyEnumType.VALUE_1.getName(), java.sql.Types.OTHER)
// or
.addValue("type", MyEnumType.VALUE_1, java.sql.Types.OTHER)
To make it more convenient, you can extend from MapSqlParameterSource to get something like this:
public static class CustomMapSqlParameterSource extends MapSqlParameterSource {
public CustomMapSqlParameterSource addEnum(String paramName, Object value) {
if (!value.getClass().isEnum()) {
throw new IllegalArgumentException("Given parameter is not of Java type enum");
}
addValue(paramName, value, java.sql.Types.OTHER);
return this;
}
}
Wrapping it up
This blog post showed you, how you can use native PostgreSQL enumerations with native Java and make them both work with Spring Data JDBC and Spring JDBC.
ERROR: Operator does not exist: character varying = integer
Getting an error Operator does not exist: character varying = integer when executing an insight
![]()
Written by Boyan Barnev
Updated over a week ago
Problem
You created an SQL insight and when you execute it (or save it and view it) you get an error message stating: ERROR: Operator does not exist: character varying = integer

Cause
The above error means that somewhere in your insight you are trying to compare a text string to a numeric value. SQL can’t directly recognize the text as number, thus the comparison is not possible.
You can easily identify if that’s the case if you do a SELECT statement for the fields you want to use in your insight and observe their output by clicking the Execute button in your insight editor. If the value is surrounded in quotation marks, then it’s coming through as a text. If it’s not, then it’s numeric.
Here are two examples:
-
In the below example, the values of the id and week fields are coming through as text:
{
"data_source_id": "5ec29e7c53e7610001d5f1be",
"id": "4",
"sync_date": "2020-06-25T00:00:00",
"week": "3"
}
2. In this example, the values of the id and week fields are coming through as numeric:
{
"data_source_id": "5ec29e7c53e7610001d5f1be",
"id": 4,
"sync_date": "2020-06-25T00:00:00",
"week": 3
}
Solution
If you must compare the values you’re extracting against numeric values, you have to cast your fields and specify the desired format. For example:
SELECT week FROM my_table WHERE id::int=4
instructs SQL to interpret the value in the id field as integer, and enables you to compare it to an integer value.
Additional information
-
In this article we use the :: operator to cast to a numeric type. You can read more about it here: PostgreSQL numeric data types
Hi Folks,
PSQLException: ERROR: operator does not exist: integer = character varying [see full error messages below.]
This error occurs when I attempt to add a parameter to a prepared statement. Everything I’ve read indicates that the likely cause is that I do not use the right datatype when adding the parameter to my prepared statement. For example,
PreparedStatement ps = conn.prepareStatement(«select article_title from articles where article_id = ?»);
ps.setString(urlParameters.get(«article_id»));
Here article_id is an integer in the database, but the parameter I set is a string.
However, I am not using Java directly, so I don’t have a ps.setString() statement. I am using the JSTL, specifically, the SQL tag library.
This is my code:
<%@ taglib prefix=»c» uri=»http://java.sun.com/jsp/jstl/core» %>
<%@ taglib prefix=»sql» uri=»http://java.sun.com/jsp/jstl/sql» %>
<c:set var=»query» value=»
select a.article_id, a.title, a.pub_year, a.article_type, a.citation, au.lname, au.fname
from (articles a inner join authors_articles aa on a.article_id = aa.article_id)
inner join authors au on aa.author_id = au.author_id
where a.article_id = ?»
/>
<sql:query var=»articleInfo» sql=»${query}»>
<sql:param value=»${param.article_id}» />
</sql:query>
The error occurs on the <sql:param …> line. «param.article_id» is indeed a string (it’s a URL parameter). The problem that I have is that I can’t specify the datatype of ${param.article_id} or convert it to an integer. I’ve tried to cast it to an int using to_number() in the query, but I get «function does not exist» from Postgres.
How can I convert the string to an int in my JSP file?
Mark
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException:
select a.article_id, a.title, a.pub_year, a.article_type, a.citation, au.lname, au.fname
from (article a inner join authors_articles aa on a.article_id = aa.article_id)
inner join authors au on aa.author_id = au.author_id
where a.article_id = ?: ERROR: operator does not exist: integer = character varying
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Position: 276
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.showReference_jsp._jspService(showReference_jsp.java:174)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = character varying
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Position: 276
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doEndTag(Unknown Source)
org.apache.jsp.showReference_jsp._jspx_meth_sql_005fquery_005f0(showReference_jsp.java:241)
org.apache.jsp.showReference_jsp._jspService(showReference_jsp.java:96)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
У меня есть веб-приложение Java EE, разработанное в старой версии Eclipse (Ganymede, если я правильно помню). Недавно я перешел на Kubuntu 12.04 LTS и перенес приложение на Eclipse Kepler (которое я скачал и установил с веб-сайта Eclipse). Он использует уровень соответствия Java 1.6, а целевой контейнер — Tomcat 6.
Моя проблема в том, что теперь я получаю сообщение об ошибке:
org.postgresql.util.PSQLException: ОШИБКА: оператор не существует: целое число = переменный символ
когда приложение встречает страницу с определенным запросом Postgres. Я использую теги JSTL sql:query и sql:param для реализации подготовленного оператора на странице jsp. Я знаю, что это считается плохой практикой, но я не являюсь первоначальным автором, и этот метод используется во всем приложении.
Ошибка возникает из-за попытки присвоить строку целому числу в теге sql:param. В предыдущей настройке любой кастинг происходил прозрачно и не было ошибки. С новой настройкой я получаю сообщение об ошибке.
Я читал, что в Postgres 8.3 было введено более строгое приведение типов, что могло вызвать эту ошибку, но я использую jar-файл Postgres 8.2 JDBC 4 в своем приложении, поэтому он должен работать. Я в тупике. Возможно, у кого-то есть идея?
Я наткнулся на обходной путь, чтобы умножить строку на 1 перед сравнением:
http://dev-answers.blogspot.co.uk/2010/08/type-coercion-in-jstl-for-sqlparam.html
Но это немного кладж, и мне пришлось бы изменить много страниц. Но это академично, потому что я все равно не должен сталкиваться с проблемой.
Спасибо за чтение. Любая помощь очень ценится.
Hi there,
Does someone know about an issue with hibernate 3.x and Postgres > 8.2 ?
We currently use Postgres 8.2.x and hibernate 3.2 within glassfish v2ur2.
We plan to migrate to an earlier machine with a little refresh of all of that.
That means Postgres 8.4.1, hibernate 3.3.2, glassfish v2.1.1
For now, i just run our application in this new environment as it.
Here is the trouble
Code:
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637)
at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:107)
at hmd003.metier.ClientServiceBean.getClientForIhm(ClientServiceBean.java:292)
… number of lines
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2235)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
… number of lines
Caused by: [color=#800000]org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer[/color]
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Position: 5163
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
… number of lines
A first look at postgres mailing list lets me know that
* postgres is more strict with the SQL syntax.
* Hibernate would SQL generate code with string parameter (setString) even for int type.
In fact i can get this kind of error in pure SQL.
If I run the query (where ‘num’ is an int) :
Code:
select * from client_client where num = ‘950000’::varchar
Then Postgres 8.2 returns the expected result ; But Postgres 8.4 shoots me with
Code:
ERROR: operator does not exist: integer = character varying
LINE 1: select * from client_client where num = ‘950000’::varchar
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
That lets me believe hibernate postgreSQLDialect could generate a dirty SQL for 8.4.
Could someone tell me if there is an issue or maybe I’m wrong ?
Thanks you for reading this long post 🙂
Here come more details about this case, if needed.
the query was
Code:
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public Client getClientForIhm(int idClient) {
Query query = em.createQuery(
«Select distinct c » +
«from Client c » +
«left join fetch c.listeTelecom_telecoms tc left join fetch tc.refNatureTelecom » +
«left join fetch c.listeAdresse_adresses » +
«left join fetch c.dernierCatalogueEnvoye » +
«left join fetch c.idCodeAnalytique_contactOrigine » +
«left join fetch c.langage » +
«left join fetch c.marque » +
«where c.num = :idClient»);
query.setParameter(«idClient», idClient);
Client client = (Client) query.getSingleResult();
//… more code
The entity looks like
Code:
@Entity @org.hibernate.annotations.Entity (dynamicInsert=true, dynamicUpdate=true)
@Table (name=»client_client»)
@Proxy @BatchSize (size=10)
public class Client implements Serializable {
private static final long serialVersionUID = 1L;
@Id @GeneratedValue (strategy=GenerationType.SEQUENCE, generator=»client_num_seq»)
@SequenceGenerator (name=»client_num_seq», sequenceName=»client_num_seq», allocationSize = 1, initialValue=1)
private Integer num;
// … more code
Issue
- Dashbuilder throws
integer = character varyingERROR when PostgreSql database is used and user clicks on a process graph . Here is the snippet of the stack trace for reference.
...
Thread id=AJP-THREAD-POOL-411
...
Thread group=uq-ajp-thread-pool
Request URL=/dashbuilder/Controller?csrf=53057644
Request IP=10.10.10.10
...
Request header:user-agent=Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36
Request header:referer=https://10.10.10.10/dashbuilder/Controller?csrf=98226897
Request header:cookie=JSESSIONID=4Dol8wnXC11V-vxhJYV1zkNw.wewrtt12; dashbuilderNavigationPoint=es-1jn-2; JSESSIONIDSSO=1wPDP3LjrWes+rEryTPpqkbC; region_left_web_2_0_cookie=1
Request param:csrf=53057644
Tx id=174338241
Tx Isolation=2
Tx Auto commit=false
Error id=1474497109052
...
Error stack trace=org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = character varying
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Position: 177
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:302)
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
at org.jboss.dashboard.dataset.sql.SQLDataSet.load(SQLDataSet.java:116)
at org.jboss.dashboard.dataset.sql.SQLDataSet._filterInDB(SQLDataSet.java:188)
at org.jboss.dashboard.dataset.sql.SQLDataSet.filter(SQLDataSet.java:180)
at org.jboss.dashboard.dataset.DataSetManagerImpl.filterDataSet(DataSetManagerImpl.java:67)
at org.jboss.dashboard.dataset.DataSetManagerImpl$Proxy$_$$_WeldClientProxy.filterDataSet(DataSetManagerImpl$Proxy$_$$_WeldClientProxy.java)
at org.jboss.dashboard.provider.DataProviderImpl.filterDataSet(DataProviderImpl.java:223)
at org.jboss.dashboard.ui.Dashboard.filter(Dashboard.java:324)
at org.jboss.dashboard.ui.Dashboard.filter(Dashboard.java:286)
at org.jboss.dashboard.ui.Dashboard.filter(Dashboard.java:265)
at org.jboss.dashboard.ui.components.chart.NVD3ChartViewer.actionApplyLink(NVD3ChartViewer.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.dashboard.ui.components.BeanHandler.handle(BeanHandler.java:152)
at org.jboss.dashboard.ui.components.BeanDispatcher.handle(BeanDispatcher.java:133)
at org.jboss.dashboard.ui.components.BeanDispatcher.performRequestHandling(BeanDispatcher.java:124)
at org.jboss.dashboard.ui.components.BeanDispatcher.handleRequest(BeanDispatcher.java:46)
at org.jboss.dashboard.ui.components.BeanDispatcher$Proxy$_$$_WeldClientProxy.handleRequest(BeanDispatcher$Proxy$_$$_WeldClientProxy.java)
at org.jboss.dashboard.ui.panel.PanelDriver.panelActionFactory(PanelDriver.java:1237)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.dashboard.ui.panel.PanelDriver._execute(PanelDriver.java:817)
at org.jboss.dashboard.ui.panel.PanelDriver.execute(PanelDriver.java:780)
at org.jboss.dashboard.ui.panel.kpi.KPIDriver$Proxy$_$$_WeldClientProxy.execute(KPIDriver$Proxy$_$$_WeldClientProxy.java)
at org.jboss.dashboard.ui.controller.requestChain.RequestDispatcher.processRequest(RequestDispatcher.java:93)
at org.jboss.dashboard.ui.controller.requestChain.RequestDispatcher$Proxy$_$$_WeldClientProxy.processRequest(RequestDispatcher$Proxy$_$$_WeldClientProxy.java)
at org.jboss.dashboard.ui.controller.RequestProcessor.run(RequestProcessor.java:68)
at org.jboss.dashboard.ui.controller.RequestProcessor$Proxy$_$$_WeldClientProxy.run(RequestProcessor$Proxy$_$$_WeldClientProxy.java)
at org.jboss.dashboard.ui.controller.ControllerServlet$1.txFragment(ControllerServlet.java:174)
at org.jboss.dashboard.database.hibernate.HibernateTransaction.executeFragment(HibernateTransaction.java:252)
at org.jboss.dashboard.database.hibernate.HibernateTxFragment.executeInitiator(HibernateTxFragment.java:179)
at org.jboss.dashboard.database.hibernate.HibernateTxFragment.execute(HibernateTxFragment.java:167)
at org.jboss.dashboard.ui.controller.ControllerServlet.processTheRequest(ControllerServlet.java:170)
at org.jboss.dashboard.ui.controller.ControllerServlet.service(ControllerServlet.java:135)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:512)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:419)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:559)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:475)
at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:454)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2562)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
...
- The query responsible for throwing the above error was something like this.
select processVersion, count(processinstanceid) as pcount from processinstancelog where processVersion is not null and (processname = ?) and 1 = 1 and (status = ?) and 1 = 1 and 1 = 1 and 1 = 1 group by processVersion
How to solve this problem?
Environment
- Red Hat JBoss BPM Suite (BPMS)
- 6.1.x
- 6.3.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.
Current Customers and Partners
Log in for full access
Log In