Bug reference: 17427 Logged by: Ahmed Tareque Email address: tareque.bracu@gmail.com PostgreSQL version: 14.0 Operating system: Windows Description:
Error : SQL Error: 0, SQLState: 42846. ERROR: cannot cast type bytea to bigint could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Due to the presence of the Java stuff this doesn't qualify as a PostgreSQL bug report and thus this is the wrong place to post.
It is also unlikely to be an actual bug in any vendor software, rather it is likely that you just are not using the API correctly. For questions of that nature an email to either the PostgreSQL -general list or a Java-oriented community is more useful, the latter being much more likely to find an audience that can assist you.
"AND (:tamTypeId is null or tap.id = cast(:tamTypeId AS bigint))
The only way you get the aforementioned error is if PostgreSQL, when it executes this query, thinks that the value in the cast is of type bytea; and it will not matter whether the value is null or not. But the logic as to how "cast(:tamTypeId as bigint)" is transformed into SQL that is sent to the server is completely outside the purview of PostgreSQL and as such, as noted above, outside the purview of this mailing list.