Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FinderMethods#exists? sql generation to make picky sql servers happy #1139

Closed
wants to merge 6 commits into from

Conversation

iaddict
Copy link
Contributor

@iaddict 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

@iaddict
Copy link
Contributor Author

iaddict commented Aug 17, 2011

A test case has been added.

@mhfs
Copy link
Contributor

mhfs commented Feb 28, 2012

@iaddict out of curiosity, since exists? is extensively tested, does the existent tests break against SQL Server?

@rafaelfranca
Copy link
Member

This can't be merged automatically.

If you still have this issue, please rebase it and I'll glad to put this is in discussion with the Core Team.

@carlosantoniodasilva
Copy link
Member

This seems to be recurrent, I've already closed 3 issues explaining the same problem, linked above. Unfortunately this pull request does not apply anymore, as @rafaelfranca pointed, so if you can bring it up-to-date, we can go ahead with it. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants