[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3637) Union in where doesn't works for Sybase, need to evict test case

Gail Badner (JIRA) noreply at atlassian.com
Fri Dec 12 16:53:38 EST 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31946#action_31946 ] 

Gail Badner commented on HHH-3637:
----------------------------------

Sybase doc says "You cannot use the union operator in a subquery."

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc32300.1502/html/sqlug/X86286.htm

It looks like the test passed for SQLServerDialect. Since SQLServerDialect extends SybaseDialect, the test would also be skipped for  SQLServerDialect. It would be best to skip this test only when necessary.

This can be done by adding a method like, Dialect.supportsUnionInSubquery(). Assuming that DynamicFilterTest#testSqlSyntaxOfFiltersWithUnions() passes with most dialects, then it should return true. SybaseDialect.supportsUnionInSubquery() can override it to return false and SQLServerDialect can override the SybaseDialect implementation to return true.

You can see similar examples in Dialect.

> Union in where doesn't works for Sybase, need to evict test case
> ----------------------------------------------------------------
>
>                 Key: HHH-3637
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3637
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: testsuite
>         Environment: Sybase ASE 15.0.2
>            Reporter: Juraci Paixao Krohling
>            Assignee: Juraci Paixao Krohling
>         Attachments: DynamicFilterTest.java.diff
>
>
> It seems that Sybase doesn't supports UNION inside WHERE clauses, causing the test DynamicFilterTest#testSqlSyntaxOfFiltersWithUnions to fail. The scenario for this test case is not described in the documentation, but I would expect it to work:
> http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc32300.1502/html/sqlug/X86286.htm
> The query is:
>     select
>         category0_.CAT_ID as CAT1_6_,
>         category0_.name as name6_,
>         category0_.eff_start_dt as eff3_6_,
>         category0_.eff_end_dt as eff4_6_ 
>     from
>         CATEGORY category0_ 
>     where
>         'abc' in (
>             select
>                 d.reg 
>             from
>                 department d 
>             where
>                 (
>                     d.dept_id=123
>                 ) 
>             union
>             select
>                 p.name 
>             from
>                 sales_person p 
> 		)
> 		
> If executed only the queries from inside the where clause (the two selects with union), it works as expected. Also, if removed the union and one of the queries inside the where, it works as expected. So, the problem happens only when using union inside a where clause.
> For now, I'd suggest to evict this test for Sybase. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list