Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
arkadiyk opened this Issue · 6 comments

4 participants

arkadiy kraportov georgiev Brooke M. Fujita Carlos Antonio da Silva
arkadiy kraportov
 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

Brooke M. Fujita

+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.

arkadiy kraportov

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

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

opened a pull request for that: #2062

Carlos Antonio da Silva

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

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

Closes #1139.

Fixes #2553, #1141, #1623 and #2062.
179276e
Rafael Mendonça França rafaelfranca referenced this issue from a commit
Rafael Mendonça França 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.