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

查看:23
本文介绍了是否可以在主要 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

描述每个数据库如何使用 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 数据库 11g 第 2 版及更高版本 - 默认情况下,没有,但存在称为基于版本的重新定义的替代方案
  • 旧版本的 Oracle - 没有;DDL 导致隐式提交
  • SQL Server - 是的
  • Sybase Adaptive Server - 是
  • DB2 - 是的
  • Informix - 是的
  • Firebird (Interbase) - 是

SQLite 似乎也具有事务性 DDL.我能够在 SQLite 中 ROLLBACK 一个 CREATE TABLE 语句.它的 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天全站免登陆