fix(postgresql): Upsert in postgresql#2133
Merged
yevgenypats merged 1 commit intocloudquery:mainfrom Sep 29, 2022
shimonp21:fix_upsert
Merged
fix(postgresql): Upsert in postgresql#2133yevgenypats merged 1 commit intocloudquery:mainfrom shimonp21:fix_upsert
yevgenypats merged 1 commit intocloudquery:mainfrom
shimonp21:fix_upsert
Conversation
disq
approved these changes
Sep 29, 2022
yevgenypats
approved these changes
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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