Re: DDLs in Transactions...? - Mailing list pgsql-hackers

From Mark Pritchard
Subject Re: DDLs in Transactions...?
Date
Msg-id EGECIAPHKLJFDEJBGGOBGEKBFOAA.mark@tangent.net.au
Whole thread Raw
In response to DDLs in Transactions...?  (james@unifiedmind.com (James Thornton))
List pgsql-hackers
Looks like it supports transactions:

[postgres@drow postgres]$ /usr/local/pgsql/bin/psql template1
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms      \h for help with SQL commands      \? for help on internal slash commands
    \g or terminate with semicolon to execute query      \q to quit
 

template1=# begin;
BEGIN
template1=# create table intransaction (field1 int);
CREATE
template1=# rollback;
ROLLBACK
template1=# select * from intransaction;
ERROR:  Relation 'intransaction' does not exist
template1=# begin;
BEGIN
template1=# create table intransaction (field1 int);
CREATE
template1=# commit;
COMMIT
template1=# select * from intransaction ;field1 
--------
(0 rows)

template1=# begin;       
BEGIN
template1=# drop table intransaction;
DROP
template1=# rollback; 
ROLLBACK
template1=# select * from intransaction ;field1 
--------
(0 rows)

template1=# begin;
BEGIN
template1=# drop table intransaction;
DROP
template1=# commit;
COMMIT
template1=# select * from intransaction;
ERROR:  Relation 'intransaction' does not exist
template1=# 

Cheers,

Mark Pritchard

> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org]On Behalf Of James Thornton
> Sent: Sunday, 30 December 2001 8:12 AM
> To: pgsql-hackers@postgresql.org
> Subject: [HACKERS] DDLs in Transactions...?
> 
> 
> How does PG handle DDL statements that are wrapped in a transaction?
> Does it roll them back if one fails, or is it like Oracle?
> 
> Where is this documented?
> 
> Thanks.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Bulkloading using COPY - ignore duplicates?
Next
From: Tom Lane
Date:
Subject: Re: More problem with scripts