Add Insert query execution without RETURNING clause #1208
Merged
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.
PR Info
Some databases do not support it or it may not be desirable to return from an insert statement. For example, #485 (idk why it is closed).
In TimescaleDB, you cannot use RETURNING in some cases that are fundamental.
Query Error: error returned from database: insert with ON CONFLICT or RETURNING clause is not supported on compressed chunks
.This PR doesn't address most of #485 like the codegen, representation, or selection for tables without primary keys. This PR only provides an alternative insert execution path that works for TimescaleDB hypertables.
New Features
Inserts now can be performed without returning last id. This is useful, if you want to insert many rows, if you do not have any primary keys, if you cannot use the RETURNING clause.
Bug Fixes
This is an essential feature gap compared to Diesel.
Breaking Changes
None
Changes
Adds an
Insert::exec_without_returning
function parallel toInsert::exec
andInsert::exec_with_returning
.