Fix FinderMethods#exists? sql generation to make picky sql servers happy - 3 0 stable #1141

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
Contributor

iaddict commented May 19, 2011

Minimal change to query generation of FinderMethods#exists? that makes SQLServer and others happy that do not like columns without an alias.

Without this patch MS-SQLServer doesn't like the generated SQL and barks for FinderMethods#exists?, ie:

ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: No column was specified for column 2 of 't'.: SELECT t.* FROM (SELECT ROW_NUMBER() OVER(ORDER BY huhu.id) AS _row_num, 1 FROM huhu WHERE huhu.[id] = 83287) AS t WHERE t._row_num BETWEEN 1 AND 1

Minimal change to query generation of FinderMethods#exists? that make…
…s SQLServer and others happy that do not like columns without an alias.

idev commented Jun 6, 2011

+1 please fix

Contributor

jonkessler commented Apr 25, 2012

@iaddict Is this still an issue? If not, please close it. Thanks.

Owner

rafaelfranca commented Apr 27, 2012

This pull request is for a no longer supported Rails version. If you still have this issue please open a new pull request pointing to master.

Thank you so much for your time.

rafaelfranca added a commit that referenced this pull request Jun 10, 2012

Add test to column alias in `exists?` SQL.
This behavior was added in dd286a4

Closes #1139.

Fixes #2553, #1141, #1623 and #2062.

rafaelfranca added a commit that referenced this pull request Jun 10, 2012

Add test to column alias in `exists?` SQL.
This behavior was added in be4ecdc.

Closes #1139.

Fixes #2553, #1141, #1623 and #2062.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment