是否可以在主要的SQL数据库中回滚CREATE TABLE和ALTER TABLE语句? [英] Is it possible to roll back CREATE TABLE and ALTER TABLE statements in major SQL databases?

查看:380
本文介绍了是否可以在主要的SQL数据库中回滚CREATE TABLE和ALTER TABLE语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个发布DDL的程序。我想知道是否可以回滚 CREATE TABLE 和类似的DDL

I am working on a program that issues DDL. I would like to know whether CREATE TABLE and similar DDL can be rolled back in


  • Postgres

  • MySQL

  • SQLite


  • Postgres
  • MySQL
  • SQLite
  • et al

描述每个数据库如何使用DDL处理事务。

Describe how each database handles transactions with DDL.

推荐答案

http://wiki.postgresql.org/wiki/Transactional_DDL_in_PostgreSQL:_A_Competitive_Analysis 提供了有关PostgreSQL的此问题的概述

http://wiki.postgresql.org/wiki/Transactional_DDL_in_PostgreSQL:_A_Competitive_Analysis provides an overview of this issue from PostgreSQL's perspective.

根据本文档,DDL是否具有事务性?

Is DDL transactional according to this document?


  • PostgreSQL-是

  • MySQL-不; DDL导致隐式提交

  • Oracle Database 11g第2版及更高版本-默认情况下不存在,但是存在一种称为基于版本的重新定义的替代方法

  • Oracle版本-否; DDL导致隐式提交

  • SQL Server-是

  • Sybase Adaptive Server-是

  • DB2-是

  • Informix-是

  • Firebird(Interbase)-是

  • PostgreSQL - yes
  • MySQL - no; DDL causes an implicit commit
  • Oracle Database 11g Release 2 and above - by default, no, but an alternative called edition-based redefinition exists
  • Older versions of Oracle - no; DDL causes an implicit commit
  • SQL Server - yes
  • Sybase Adaptive Server - yes
  • DB2 - yes
  • Informix - yes
  • Firebird (Interbase) - yes

SQLite也似乎也具有事务性DDL。我能够在SQLite中 ROLLBACK 一个 CREATE TABLE 语句。其创建表文档未提及任何特殊的交易陷阱。

SQLite also appears to have transactional DDL as well. I was able to ROLLBACK a CREATE TABLE statement in SQLite. Its CREATE TABLE documentation does not mention any special transactional 'gotchas'.

这篇关于是否可以在主要的SQL数据库中回滚CREATE TABLE和ALTER TABLE语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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