Re: Transactional DDL - Mailing list pgsql-general

From Dawid Kuroczko
Subject Re: Transactional DDL
Date
Msg-id 758d5e7f0706020931i3aaadb35h225fbc274ef7b878@mail.gmail.com
Whole thread Raw
In response to Re: Transactional DDL  ("Jasbinder Singh Bali" <jsbali@gmail.com>)
Responses Re: Transactional DDL  ("Harpreet Dhaliwal" <harpreet.dhaliwal01@gmail.com>)
List pgsql-general
On 6/2/07, Jasbinder Singh Bali <jsbali@gmail.com> 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

Actually, Oracle inserts implicit COMMIT after each DDL.

So, if you have:

BEGIN;
INSERT INTO foo (bar) VALUES (1);
CREATE INDEX foo_bar ON foo (bar);
-- Here Oracle will insert implicit COMMIT, thus your foo table will
have value 1 commited.
-- And here Oracle will BEGIN a new trasaction.
INSERT INTO foo (bar) VALUES (2);
ROLLBACK;
-- And you will rollback the insert of value 2.  Value 1 remains in the table,
-- because it is already committed.

   Regards,
       Dawid

pgsql-general by date:

Previous
From: PFC
Date:
Subject: Re: Stored Procedures and Functions
Next
From: Erwin Brandstetter
Date:
Subject: Re: There can be only one! How to avoid the "highlander-problem".