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

ActiveRecord::ConnectionAdapters::SQLServerAdapter does not support upsert #1044

Closed
felzend opened this issue Mar 19, 2023 · 2 comments
Closed

Comments

@felzend
Copy link

felzend commented Mar 19, 2023

Issue

Trying to use an upsert operation on my model, but it's showing an error telling this adapter has no implementation for that.

Expected behavior

Upsert operation working with no exceptions.

Actual behavior

Throwing an exception:

ActiveRecord::ConnectionAdapters::SQLServerAdapter does not support upsert

raise ArgumentError, "#{connection.class} does not support upsert"

How to reproduce

Simply calling

image

Details

  • Rails version: 7.0.4.3
  • SQL Server adapter version: 7.0.1.0
  • TinyTDS version: 2.1.5
  • FreeTDS details:

SQL SERVER 16.0.4003.1 - Developer Edition

@aidanharan
Copy link
Contributor

The adapter doesn't support upsert as Microsoft SQL Server doesn't natively support it either. There were investigations in #859 to see if upsert could be supported using MERGE but they have been unsuccessful.

@Michoels
Copy link

Michoels commented Dec 7, 2023

Is there no way to implement this in SQL Server?

upsert is a valuable feature and is required for supporting Solid Cache (See #1122)

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

No branches or pull requests

3 participants