We're updating the issue view to help you get more done. 

SQLServer2005LimitHandler skips column alias generation

Description

While inserting generated aliases into the query, position of last comma can exceed initially calculated index of FROM keyword.

SQLServer2005DialectTestCase.java

1 2 3 4 5 6 7 8 9 10 11 @Test public void testGetLimitStringAliasGeneration() { final String notAliasedSQL = "select column1, column2, column3, column4 from table1"; assertEquals( "WITH query AS (SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__ FROM ( " + "select column1 as page0_, column2 as page1_, column3 as page2_, column4 as page3_ from table1 ) inner_query ) " + "SELECT page0_, page1_, page2_, page3_ FROM query WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?", dialect.buildLimitHandler( notAliasedSQL, toRowSelection( 3, 5 ) ).getProcessedSql() ); }

Environment

Microsoft SQL Server

Status

Assignee

Lukasz Antoniak

Reporter

Lukasz Antoniak

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

4.3.0.Beta3

Priority

Minor