[WIP] BUG: postgres serial id conflict during an upsert join, fix #33148 #34216
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.
Description
fix #33148, @devfaz74 provides data test in it.
As explained in the issue, serial type column causes broken link between parent and child table using the upsert on edit feature.
The default values
nextval('public.parent_id_seq'::regclass)
is used to create the child entity but there is no update when parent entity is commited (andnextval('public.parent_id_seq'::regclass)
is converted to int value during this step so the link is broken).The (not obvious for users) solution is to activate the
evaluateDefaultValues
option in the project properties menu.Maybe we should activate this option by default when a join is added with the
upsertOnEdit
flag. That what I propose in this PR, but I am not sure it's the best solution because :evaluateDefaultValues
, if the user remove the join in the future.evaluateDefaultValues
option...I let the subject opened to other solution. If this one is accepted I will create the test in consequence.
Checklist :
Commit messages are descriptive and explain the rationale for changes.
Commits which fix bugs include
Fixes #11111
at the bottom of the commit message. If this is your first pull request and you forgot to do this, write the same statement into this text field with the pull request description.New unit tests have been added for relevant changes
You have run the
scripts/prepare-commit.sh
script (https://github.com/qgis/QGIS/blob/master/.github/CONTRIBUTING.md#contributing-to-qgis) before each commit.If you didn't do this, you can also run
./scripts/astyle-all.sh
from your source folder.You have read the QGIS Coding Standards (https://docs.qgis.org/testing/en/docs/developers_guide/codingstandards.html) and this PR complies with them