Skip to content
This repository

FinderMethods#exists? does not work with SQL Server #2553

Closed
iaddict opened this Issue · 2 comments

2 participants

iaddict Carlos Antonio da Silva
iaddict

The generated SQL does not work with SQL Server. Following the AR exception:

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

The problem is the column '1' that has no alias. It has to read something like 1 as _one.

A pull request exists that fixes this issue: #1141

iaddict

Why ohh why does no one care!?

Please apply the patch.
Many thanks!

Carlos Antonio da Silva

Same as #1139, please follow instructions there if the issue still exists on latest Rails version, I'm closing this one. Thanks.

Francesco Rodríguez frodsan 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
Francesco Rodríguez frodsan 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
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.