Skip site navigation (1) Skip section navigation (2)

Re: Truncate table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Burak Seydioglu" <buraks78(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Truncate table
Date: 2007-08-24 01:34:22
Message-ID: 15860.1187919262@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
"Burak Seydioglu" <buraks78(at)gmail(dot)com> writes:
> I have been reading about transactional DDLs at
> http://archives.postgresql.org/pgsql-general/2007-06/msg00190.php.
> This discussion seems to be recent though; is this feature available
> in version 7.4?

It would've taken you less time to test it than to post the question.

regression=# select version();
                            version                             
----------------------------------------------------------------
 PostgreSQL 7.4.17 on hppa-hp-hpux10.20, compiled by GCC 2.95.3
(1 row)

regression=# create table foo (f1 int);                 
CREATE TABLE
regression=# insert into foo values(1);
INSERT 1555575 1
regression=# begin;
BEGIN
regression=# truncate table foo;
TRUNCATE TABLE
regression=# abort;
ROLLBACK
regression=# select * from foo;
 f1 
----
  1
(1 row)

Looks transactional to me ...

Just FYI, 7.3 fails the same test with

regression=# truncate table foo;
ERROR:  TRUNCATE TABLE cannot run inside a transaction block

so it got fixed between 7.3 and 7.4.

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Oliveiros CristinaDate: 2007-08-24 11:50:58
Subject: How to import a csv
Previous:From: Burak SeydiogluDate: 2007-08-23 22:08:07
Subject: Truncate table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group