Re: TODO item completed - Make a transaction-safe TRUNCATE

Started by Bruce Momjianabout 23 years ago1 messagesdocs
Jump to latest
#1Bruce Momjian
bruce@momjian.us

TODO updated:

Make a transaction-safe TRUNCATE (Rod)

CVS commit was:

date: 2002/11/23 04:05:51; author: momjian; state: Exp; lines: +14 -15
Transaction safe Truncate

Rod Taylor

---------------------------------------------------------------------------

Rod Taylor wrote:
-- Start of PGP signed section.

- Make a transaction-safe TRUNCATE

rbt=# select version();
version
------------------------------------------------------------------------
PostgreSQL 7.4devel on i386-unknown-freebsd4.7, compiled by GCC 2.95.4
(1 row)

rbt=# select * from junk;
col1
-----------
some text
(1 row)

rbt=# begin;
BEGIN
rbt=# truncate junk;
TRUNCATE TABLE
rbt=# select * from junk;
col1
------
(0 rows)

rbt=# rollback;
ROLLBACK
rbt=# select * from junk;
col1
-----------
some text
(1 row)

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

-- End of PGP section, PGP failed!

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073