如何在PostgreSQL中回滚更新

编程入门 行业动态 更新时间:2024-10-27 23:23:40
本文介绍了如何在PostgreSQL中回滚更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在终端中使用sql编辑PostgreSQL数据库中的某些记录时(在ubuntu lucid中),我进行了错误的更新。

While editing some records in my PostgreSQL database using sql in the terminal (in ubuntu lucid), I made a wrong update.

而不是-

update mytable set start_time='13:06:00' where id=123;

我输入-

update mytable set start_time='13:06:00';

因此,所有记录现在都具有相同的start_time值。

So, all records are now having the same start_time value.

是否可以撤消此更改?表中有大约500多个记录,我不知道每条记录的start_time值是什么

Is there a way to undo this change? There are some 500+ records in the table, and I do not know what the start_time value for each record was

它会永远丢失吗?

推荐答案

我假设这是已经提交的事务?如果是这样,那就是提交的意思,您将无法返回。

I'm assuming it was a transaction that's already committed? If so, that's what "commit" means, you can't go back.

如果幸运的话,某些数据可以恢复。立即停止数据库。

Some data may be recoverable if you're lucky. Stop the database NOW.

这是我之前针对同一主题写的一个答案。我希望它会有所帮助。

Here's an answer I wrote on the same topic earlier. I hope it's helpful.

这可能也是:在postgresql中删除已删除的行。

除非数据绝对关键,仅从备份中还原,否则会容易得多,也不会那么痛苦。如果您没有备份,请考虑一下自己。

Unless the data is absolutely critical, just restore from backups, it'll be lots easier and less painful. If you didn't have backups, consider yourself soundly thwacked.

更多推荐

如何在PostgreSQL中回滚更新

本文发布于:2023-10-19 19:31:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1508543.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   PostgreSQL   中回滚

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!