OUTPUT: PostgreSQL support (RETURNING clause)
See original GitHub issueUsing postgres I use “returning *” when inserting or updating data. This allows you to get not only the primary key but also all the fields. Is it possible to do this with linq2db?
I think in some cases this is more convenient than inserting data and then selecting them. If you use “returning *”, you get an atomic operation and you do not need to select the primary key type.
Something like
T obj = db.Insert<T>(T item);
T obj = db.Update<T>(T item);
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Documentation: 15: 6.4. Returning Data from Modified Rows
The INSERT , UPDATE , and DELETE commands all have an optional RETURNING clause that supports this. Use of RETURNING avoids performing an...
Read more >Documentation: 15: INSERT
The optional RETURNING clause causes INSERT to compute and return value(s) based on each row actually inserted (or updated, if an ON CONFLICT...
Read more >PostgreSQL - The RETURNING Clause - Programster's Blog
The RETURNING clause allows one to return the rows that one inserts, updates, or deletes. This is a really neat/useful feature as it...
Read more >How to Use UPDATE RETURNING Clause in PostgreSQL
In PostgreSQL, the UPDATE RETURNING clause not only updates the selected rows but also retrieves the modified rows.
Read more >The Postgres RETURNING clause
This clause allows us to change the output of the UPDATE query. So, instead you pre-fetching the IDs before updating, we can retrieve...
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
Upvote for feature implementation
This feature is in our TODO list. After CTE feature, we will start implementing this one.