What will happen if I run rollabck without begin in PostgresSQL statement?



  • I have run below statement without begin then, show a warning message (WARNING: there is no transaction in progress) like below image. But actually that table was deleted. Why it is not roll backed? Is there any effect in future transaction on that table?

    rollback without begin



  • https://www.postgresql.org/docs/current/app-psql.html#id-1.9.4.20.8.5.2.9.1.1.2 in psql, so every statement is implicitly committed. In other words, after delete a commit was issued by the driver, which closed the active transaction, then obviously rollback didn't do anything and resulted in the warning you saw.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2