PostgreSQL – Is there a way to know the last submission value in the table?

I am using Postgres 9.5. If I update some values ​​of a row and submit them, is there a way to get the old values ​​later? I was wondering if there is something like flashback? But this will be a selective flashback. I don’t want to roll back the entire database. I only need to restore one line.
short Answer-it is impossible.

But for future readers, you can create an array field containing historical data as follows:

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

For more information, please read the docs about arrays

p>

I am using Postgres 9.5. If I update some values ​​of a row and submit them, is there a way to get the old values ​​later? I was wondering if there is something like flashback? But this will be a selective flashback. I don’t want to roll back the entire database. I only need to restore one line.

Short answer – it’s impossible.

But for future readers, you can create an array field containing historical data as follows:

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

For more information, please read the docs about arrays

Leave a Comment

Your email address will not be published.