| From: | Michael Glaesemann <grzm(at)seespotcode(dot)net> |
|---|---|
| To: | Jasbinder Singh Bali <jsbali(at)gmail(dot)com> |
| Cc: | "Alexander Staubo" <alex(at)purefiction(dot)net>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Transactional DDL |
| Date: | 2007-06-02 15:50:26 |
| Message-ID: | 80F4E980-C713-4E80-BFA4-C5D870E00FC6@seespotcode.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Jun 2, 2007, at 10:12 , Jasbinder Singh Bali wrote:
> But its said that transactions in any RDBMS follow ACID properties.
> So if i put a create table and an Insert statement in the same
> begin end block as one single transactioin, won't both create and
> insert follow acid property, being in one single trasaction, and
> either both get committed or none, talking about oracle lets say
test=# \d
List of relations
Schema | Name | Type | Owner
--------+------+-------+----------
public | a | table | postgres
public | b | table | postgres
(2 rows)
test=# begin;
BEGIN
test=# create table foo (a integer);
CREATE TABLE
test=# insert into foo (a) values (1);
INSERT 0 1
test=# commit;
COMMIT
test=# \d
List of relations
Schema | Name | Type | Owner
--------+------+-------+----------
public | a | table | postgres
public | b | table | postgres
public | foo | table | postgres
(3 rows)
test=# select * from foo;
a
---
1
(1 row)
test=# begin;
BEGIN
test=# create table bar (a integer);
CREATE TABLE
test=# insert into bar (a) values (1);
INSERT 0 1
test=# select * from bar;
a
---
1
(1 row)
test=# \d
List of relations
Schema | Name | Type | Owner
--------+------+-------+----------
public | a | table | postgres
public | b | table | postgres
public | bar | table | postgres
public | foo | table | postgres
(4 rows)
test=# select 1/0;
ERROR: division by zero
test=# commit;
ROLLBACK
test=# \d
List of relations
Schema | Name | Type | Owner
--------+------+-------+----------
public | a | table | postgres
public | b | table | postgres
public | foo | table | postgres
(3 rows)
Michael Glaesemann
grzm seespotcode net
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Leif B. Kristensen | 2007-06-02 16:08:26 | Re: Stored Procedures and Functions |
| Previous Message | Lew | 2007-06-02 15:24:07 | Re: Delete with subquery deleting all records |