npgsql/Npgsql — pull request #160 by DavidKarlas (2014-02-09 09:51:39+00:00)
Title: Returning DB generated values on insert for EF fixing #159

Based on postgresql documentation RETURING was added in 8.2.

Here is some sample which results in newObject having proper BlogId and also random generated GuidGeneratedByPostgreDatabase by Postgresql backend.

```csharp
using (var context = new BloggingContext())
{
var newObject = context.Blogs.Create();
newObject.Name = "George";
context.Blogs.Add(newObject);
context.SaveChanges();
}

public class Blog
{
//This is also generated by DB because it's a key
public int BlogId { get; set; }
public string Name { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public Guid GuidGeneratedByPostgreDatabase { get; set; }
}
```
Some commends on code...
* _commandTree.Returning is always DbNewInstanceExpression
* RETURING ("col1","col2","col3") results in returing single column where values are joined by comma which is not what EF expects so () may not be there...
* foreach (var returingProperty in expression.Arguments) is always Arguments!=null and Arguments.Count>0
* I think I should create new class ReturingExpression but seems like waste of performance since it's only used here :) If you really want I can change that...