Bug 1057742 - PostgreSQL & H2 dialect incorrect for count distinct tuples for composite attributes
Summary: PostgreSQL & H2 dialect incorrect for count distinct tuples for composite att...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: 6.1.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: DR2
: EAP 6.3.0
Assignee: Brett Meyer
QA Contact: Zbyněk Roubalík
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks: 1063408
TreeView+ depends on / blocked
 
Reported: 2014-01-24 17:34 UTC by Stephen Fikes
Modified: 2018-12-04 17:07 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-06-28 15:37:09 UTC
Type: Bug
Embargoed:


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

Description Stephen Fikes 2014-01-24 17:34:49 UTC
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 05:44:51 UTC
Corrected upstream and will be a part of the EAP 6.3 component upgrade.

Comment 2 Kabir Khan 2014-04-04 15:28:15 UTC
Fixed by upgrade -> ON_QA

Comment 3 Martin Simka 2014-04-17 13:28:26 UTC
verified on EAP 6.3.0.ER1


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