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

Use "INSERT...RETURNING" in MariaDB. #7235

Closed
1 of 21 tasks
come25136 opened this issue Dec 31, 2020 · 3 comments · Fixed by #8673 or GulajavaMinistudio/typeorm#466
Closed
1 of 21 tasks

Use "INSERT...RETURNING" in MariaDB. #7235

come25136 opened this issue Dec 31, 2020 · 3 comments · Fixed by #8673 or GulajavaMinistudio/typeorm#466

Comments

@come25136
Copy link

come25136 commented Dec 31, 2020

Feature Description

The Problem

I want to use "INSERT...RETURNING" in MariaDB.
It can't be used with the current TypeORM.
https://mariadb.com/kb/en/insertreturning/

The Solution

I want to get the primary id of the affected INSERT query using "ON DUPLICATE KEY".

Considered Alternatives

Additional Context

Relevant Database Driver(s)

  • aurora-data-api
  • aurora-data-api-pg
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time, and I know how to start.
  • Yes, I have the time, but I don't know how to start. I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.
@imnotjames
Copy link
Contributor

What version is this available from?

@nix6839
Copy link
Contributor

nix6839 commented Feb 17, 2022

INSERT ... RETURNING was added in MariaDB 10.5.0, and returns a resultset of the inserted rows.

From Official document

@pleerock
Copy link
Member

If underlying driver (e.g. mysql package that is used for mariadb) support this - feature is relatively easy to implement. Feel free to contribute

pleerock pushed a commit that referenced this issue Feb 21, 2022
* feat: allow `returning()` on MariaDB >= 10.5.0

Closes: #7235

* build: update docker mariadb version to 10.5.13

* fix: MySqlDriver behavior returning is supported

* feat: what kind of DML returning is supported

* test: imporve test #7235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants