Bug 1057742 - PostgreSQL & H2 dialect incorrect for count distinct tuples for composite attributes
PostgreSQL & H2 dialect incorrect for count distinct tuples for composite att...
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate (Show other bugs)
6.1.1
Unspecified Unspecified
medium Severity medium
: DR2
: EAP 6.3.0
Assigned To: Brett Meyer
Zbyněk Roubalík
Russell Dickenson
:
Depends On:
Blocks: 1063408
  Show dependency treegraph
 
Reported: 2014-01-24 12:34 EST by Stephen Fikes
Modified: 2015-09-01 00:00 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
JBoss EAP 6 has been updated to allow the use of parentheses around composite attribute lists in count-distinct queries in MySQL and other databases. This was not allowed in previous versions of the product and would result in an exception being thrown for PostgreSQL. This release allows the Dialect to use the parentheses as appropriate without throwing an exception.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-28 11:37:09 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Simple pure Hibernate Maven JUnit test (4.01 KB, application/x-gzip)
2014-01-24 12:34 EST, Stephen Fikes
no flags Details

  None (edit)
Description Stephen Fikes 2014-01-24 12:34:49 EST
Created attachment 855112 [details]
Simple pure Hibernate Maven JUnit test

Description of problem:
When a composite key is used a "select count (distinct <entity_type>)" query fails to enclose the column names that make up the key attribute in parenthesis and the following exception is raised:


org.hibernate.exception.SQLGrammarException: could not extract ResultSet
	...
Caused by: org.postgresql.util.PSQLException: ERROR: function count(character varying, character varying) does not exist
  Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  Position: 8

Version-Release number of selected component (if applicable):
EAP 6.1.1 and Hibernate 4.2.0.SP1

How reproducible:
Consistently

Steps to Reproduce:
1. Using Hibernate core libraries that include the fix for https://hibernate.atlassian.net/browse/HHH-7165 (introduced in Hibernate 4.1.2), create an entity with a composite key
2. Issue a "select count (distinct <entity_type>)" query

Actual results:
Raises exception above

Expected results:
Should return a numeric count

Additional info:
https://hibernate.atlassian.net/browse/HHH-8864
Comment 1 Brett Meyer 2014-01-25 00:44:51 EST
Corrected upstream and will be a part of the EAP 6.3 component upgrade.
Comment 2 Kabir Khan 2014-04-04 11:28:15 EDT
Fixed by upgrade -> ON_QA
Comment 3 Martin Simka 2014-04-17 09:28:26 EDT
verified on EAP 6.3.0.ER1

Note You need to log in before you can comment on or make changes to this bug.