[FEATURE REQUEST] Implement returning for postgresql calculated columns

When you have a column calculated in Postgres, you need to call reload for the values to fetched from the DB.

I think it would be great if rails models could accept a list of parameters that shuold be returned after a DB operation using postgres RETURNING feature, just like it is happening with the record id.

I have opened a PR implementing this feature for create operation. The test suite is in red for now but the relevant test is passing locally.

Adding this feature has been discussed in this GH issue, but I’m posting it here per @matthewd 's suggestion. Please let me know if you guys think this feature will be accepted and I will continue working in the PR.

13 Likes

@matthewd what would be needed to get the feature request approved? I’d be happy to work with @00dav00 on implementing it as the core team sees fit.

1 Like

I’m very interested in this feature. There is a PR. Is there any way to get review from a Rails committer? Is there anything anyone else can do to help move it along? I can spend time on it if there is any way to do so that would help.

2 Likes

Just another user chiming in - this would be great to have!

2 Likes

Hi folks:

I would like to see this feature in action for people who want to use returning feature with more attributes. One use case I would like to describe is when you use views that can INSERT, in a view you could have a computed value using a CASE condition, because of this you need to reload the object when you create it.

I hope someone could push this amazing feature.

Cheers, Alfonso

1 Like