Skip to content

fix(postgresql): Upsert in postgresql#2133

Merged
yevgenypats merged 1 commit intocloudquery:mainfrom
shimonp21:fix_upsert
Sep 29, 2022
Merged

fix(postgresql): Upsert in postgresql#2133
yevgenypats merged 1 commit intocloudquery:mainfrom
shimonp21:fix_upsert

Conversation

@shimonp21
Copy link
Copy Markdown
Contributor

The previous upsert query just replaced the values with the values that were already in the table... i.e. the query was:

DO UPDATE SET
"column"=table."column"

which of course does nothing.

The new query is:

"column"=excluded."column",

which does what we want.

See https://www.postgresql.org/docs/current/sql-insert.html

Summary

@shimonp21 shimonp21 requested review from a team and yevgenypats September 29, 2022 09:12
@yevgenypats yevgenypats changed the title fix: Upsert in postgresql fix(postgresql): Upsert in postgresql Sep 29, 2022
The previous upsert query just replaced the values with the values that were already in the table...
i.e. the query was:

DO UPDATE SET
"column"=table."column"

which of course does nothing.

The new query is:

"column"=excluded."column",

which does what we want.
@yevgenypats yevgenypats merged commit 565728b into cloudquery:main Sep 29, 2022
yevgenypats added a commit that referenced this pull request Oct 4, 2022
🤖 I have created a release *beep* *boop*
---


##
[1.0.0](plugins-destination-postgresql-v0.3.0...plugins-destination-postgresql-v1.0.0)
(2022-10-04)



### Features

* **pg:** Add sentry
([#2139](#2139))
([8891808](8891808))
* **postgresql:** Add support for overwrite-delete-stale
([#2220](#2220))
([efdd136](efdd136))


### Bug Fixes

* **deps:** Update module github.com/cloudquery/plugin-sdk to v0.11.0
([#2135](#2135))
([1729467](1729467))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v0.11.2
([#2162](#2162))
([5701aa5](5701aa5))
* **deps:** Update plugin-sdk for postgresql to v0.12.2
([#2311](#2311))
([e4778ea](e4778ea))
* **postgresql:** Upsert in postgresql
([#2133](#2133))
([565728b](565728b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: Yevgeny Pats <yev.pats@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants