You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature Request: Support returning both OLD and NEW values in UPDATE operations
Problem
Currently, PostgREST's UPDATE operations can return either the new values (return=representation) or minimal information (return=minimal), but there's no way to get both the old and new values in a single operation. This is particularly useful for:
Audit logging
Event systems that need to track changes
Optimizing applications by avoiding separate SELECT queries
Maintaining atomicity when both old and new values are needed
Proposed Solution
Add support for returning both OLD and NEW values in UPDATE operations by:
Adding a new return preference (e.g., return=both or return=full)
Modifying the query builder to use RETURNING OLD.*, NEW.*
Structuring the response to clearly separate old and new values
This feature leverages existing PostgreSQL functionality (OLD/NEW references in RETURNING clauses)
That's a bit of a stretch, given that OLD/NEW for RETURNING has been committed two weeks ago - and won't make it into a stable release before October this year.
Feature Request: Support returning both OLD and NEW values in UPDATE operations
Problem
Currently, PostgREST's UPDATE operations can return either the new values (
return=representation
) or minimal information (return=minimal
), but there's no way to get both the old and new values in a single operation. This is particularly useful for:Proposed Solution
Add support for returning both OLD and NEW values in UPDATE operations by:
return=both
orreturn=full
)RETURNING OLD.*, NEW.*
Example Usage
HTTP Request:
Generated SQL:
Response:
Technical Details
Benefits
Potential Concerns
Questions
select
parameters?Would love to hear the community's thoughts on this proposal. Happy to provide additional context or adjust the proposal based on feedback.
The text was updated successfully, but these errors were encountered: