Complete INSERT and UPSERT operations support
See original GitHub issueWhat
This issue will track design and implementation of various forms of INSERT operation including UPSERT but excluding bulk inserts and select into new table statements.
Why
Right now we lack support of some insert sub-clauses/variations that are requested by users from time to time. It makes sense perform upfront design and implement it step-by-step.
Initial plans for this feature was to add translation of merge API calls to upsert-based SQL for postgresql and mysql providers but after more detailed review it became clear that it is not possible:
- UPSERT is less flexible compared to Merge API and it is not possible to implement it’s limitations using Merge API
- UPSERT support not limited to MySql and PostgreSQL and supports also databases with native merge support
Related issues
- #869 - generic issue for
OUTPUT
/RETURNING
clause support for various DML operations includingINSERT
- #979 - generic issue for
RETURNING
clause support in PostgreSQL for various DML operations includingINSERT
- #1480 - original issue to add UPSERT support though MergeAPI
- #2355 - similar to #1480 : emulation of merge using upsert
- #2528 -
INSERT ... ON CONFLICT DO NOTHING
feature request
Designs
Implementation notes and not supported functionality
In general we are not planning to implement following functionality right now:
- insert query options/hints as we have separate task for it (#2603)
- some db-specific features, implemented by single database and not expected to be used a lot. Such stuff could be implemented on request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:11 (10 by maintainers)
Top Results From Across the Web
upsert vs update vs insert - apex
Using the upsert operation, you can either insert or update an existing record in one call. To determine whether a record already exists, ......
Read more >What's the difference between INSERT, UPDATE, UPSERT ...
The INSERT option pushes the incoming records to the destination. The UPDATE option keeps track of the records being updated in the database...
Read more >Adding Table Rows using INSERT and UPSERT
This topic provides examples on how to add table rows using the SQL for Oracle NoSQL Database INSERT and UPSERT statements. You use...
Read more >What Is UPSERT and How To Use It in MySQL?
Being an atomic operation, MySQL UPSERT gets completed in a single step. For instance, for a new record, it triggers an INSERT command....
Read more >What is an upsert, and when should you use one?
Upserts are useful for anyone who works with a database to know, but the term “upsert” might not even appear in your DBMS's...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Question 1: For SQLite, how is the
InsertWith()
method different thanint Insert<TSource, TTarget>(this IQueryable<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter)
with anIQueryable<>
that was created via.AsCte()
(other than parameter order)?Is there any timeline for this?