Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ActiveRecord: .exists? generates invalid SQL for MSSQL #1623

Closed
arkadiyk opened this Issue · 6 comments

4 participants

@arkadiyk
 relation = relation.except(:select).select("1").limit(1)

The problem with MSSQL is a column has to have a name. Would it be possible to add a name? Something like this:

 relation = relation.except(:select).select("1 as _one").limit(1)

Thank you

@georgiev

+1 - same break/same fix for Firebird

@buruzaemon

+1 Hey, we are still stuck with Rails 3.0.6 because this issue is still pending... Any word on when we might see this fix?

@georgiev

One word of caution here - "_one" is not a valid Firebird column name - extra attention should be payed when choosing the column name.

@arkadiyk

let's make it "one" or "o". As long as the column has a name MS SQL should be happy.

@arkadiyk arkadiyk referenced this issue from a commit in arkadiyk/rails
@arkadiyk arkadiyk fix MSSQL and Firebird exists? problem (issue #1623) 7e2dddd
@arkadiyk

opened a pull request for that: #2062

@carlosantoniodasilva

Closing this issue in favor of pull request #2062 and #1139. Thanks!

@rafaelfranca rafaelfranca referenced this issue from a commit
@rafaelfranca rafaelfranca Add test to column alias in `exists?` SQL.
This behavior was added in dd286a4

Closes #1139.

Fixes #2553, #1141, #1623 and #2062.
179276e
@rafaelfranca rafaelfranca referenced this issue from a commit
@rafaelfranca rafaelfranca Add test to column alias in `exists?` SQL.
This behavior was added in be4ecdc.

Closes #1139.

Fixes #2553, #1141, #1623 and #2062.
6cc5e9a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.