Re: Truncate table - Mailing list pgsql-novice

From Tom Lane
Subject Re: Truncate table
Date
Msg-id 15860.1187919262@sss.pgh.pa.us
Whole thread Raw
In response to Truncate table  ("Burak Seydioglu" <buraks78@gmail.com>)
List pgsql-novice
"Burak Seydioglu" <buraks78@gmail.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

pgsql-novice by date:

Previous
From: "Burak Seydioglu"
Date:
Subject: Truncate table
Next
From: "Oliveiros Cristina"
Date:
Subject: How to import a csv