Linq2db: OUTPUT: PostgreSQL support (RETURNING clause)

Created on 22 Jan 2018  路  5Comments  路  Source: linq2db/linq2db

Using 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);
insert output postgresql feature

Most helpful comment

This feature is in our TODO list. After CTE feature, we will start implementing this one.

All 5 comments

Similar #797 & #869

This feature is in our TODO list. After CTE feature, we will start implementing this one.

What a great feature to be used if and when available.

There is already branch for this. Currently implemented functions InsertWithOutput and InsertWithOutputInto and only for SQL Server. I'll return to this soon.

Upvote for feature implementation

Was this page helpful?
0 / 5 - 0 ratings