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

Support partial update on jsonb type in postgresql. #7456

Open
2 of 21 tasks
zhaoyi0113 opened this issue Mar 9, 2021 · 2 comments
Open
2 of 21 tasks

Support partial update on jsonb type in postgresql. #7456

zhaoyi0113 opened this issue Mar 9, 2021 · 2 comments

Comments

@zhaoyi0113
Copy link

zhaoyi0113 commented Mar 9, 2021

Feature Description

Postgresql has a function json_set which can be used to update a json data partially. Or it also supports update an array of json type. It would be better to support this function in typeorm.

The Problem

I am not able to update a json field partially. For example, consider below data saved in postgresql table column.

{ firstName: '', lastName:''}

If I only update firstName, it will override lastName with empty string.

The Solution

I have to use raw sql to do json_set in order to make it work.

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.
@cuongndc
Copy link

cuongndc commented May 4, 2021

The same isssue on MySQL.

@imnotjames
Copy link
Contributor

How exactly would this work, from the perspective of a typeorm user?

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