有什么办法知道表中的最后一个提交值? [英] Is there any way to know the last commit value in a table?

查看:66
本文介绍了有什么办法知道表中的最后一个提交值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Postgres 9.5。如果我更新某行的某些值并提交,那么以后有什么方法可以获取旧值?我在想是否有类似闪回的内容?但这将是选择性的闪回。我不想回滚整个数据库。我只需要还原一行。

I am using Postgres 9.5. If I update certain values of a row and commit, is there any way to fetch the old value afterwards? I am thinking is there something like a flashback? But this would be a selective flashback. I don't want to rollback the entire database. I just need to revert one row.

推荐答案

简短答案-不可能。

但是对于将来的读者来说,您可以创建一个包含历史数据的数组字段,其格式如下:

But for future readers, you can create an array field with historical data that will look something like this:

     Column     |           Type           | 
----------------+--------------------------+------
 value          | integer                  | 
 value_history  | integer[]                |

有关更多信息,请阅读文档关于数组

For more info read the docs about arrays

这篇关于有什么办法知道表中的最后一个提交值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆