Sybase - Column alias in subselect doesn't works

Description

I could not find any reference in documentation to support it, but it seems that column aliasing in sub-selects isn't supported. I could not find any information in the docs which confirms or denies this, but running the test CriteriaQueryTest#testDetachedCriteriaAsSubQuery can confirm this.

Hibernate generates a query which ends in:
where ? in (select this_.courseCode as y0_ from Course this_ where this_.description like ?)

This fails in Sybase, with this message:
15:29:38,063 WARN JDBCExceptionReporter:77 - SQL Error: 156, SQLState: ZZZZZ
15:29:38,074 ERROR JDBCExceptionReporter:78 - Incorrect syntax near the keyword 'AS'.

Removing all "as" keywords returns the same message, even though the query itself doesn't have it. [1]
Removing the "as $alias" solves the problem.

The working line is:
where courseCode in (select this_.courseCode from Course this_ where this_.description like 'test%')

Environment

Branch_3_2_4_SP1_CP with Sybase 15

Activity

Show:
Juraci Paixão Kröhling
October 1, 2008, 3:49 PM

Forgot to add the [1] reference:

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.sqlug/html/sqlug/sqlug70.htm

This page shows the options for "column renaming" (column aliasing), but it seems that none of them works in sub-selects.

Juraci Paixão Kröhling
December 10, 2008, 5:37 PM

Tests under DynamicFilterTest are also affected (in addition to the ones in CriteriaQueryTest).

Gail Badner
January 6, 2009, 6:04 AM

I'm resolving this as a duplicate of because that issue provides more details.

Steve Ebersole
March 21, 2011, 7:04 PM

Bulk closing stale resolved issues

Assignee

Gail Badner

Reporter

Juraci Paixão Kröhling

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure