pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6635: TRUNCATE didn't recreate init fork.
2+ messages / 2 participants
[nested] [flat]

* BUG #6635: TRUNCATE didn't recreate init fork.
@ 2012-05-10 05:32 kurosawa-akira@mxc.nes.nec.co.jp
  2012-05-11 13:50 ` Re: BUG #6635: TRUNCATE didn't recreate init fork. Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: kurosawa-akira@mxc.nes.nec.co.jp @ 2012-05-10 05:32 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      6635
Logged by:          Akira Kurosawa
Email address:      kurosawa-akira@mxc.nes.nec.co.jp
PostgreSQL version: 9.1.3
Operating system:   Red Hat Enterprise Linux 5.5
Description:        

When I executed TRUNCATE command to unlogged table,
init fork of new relfilenode (include toast) wasn't created.

It seems that ExecuteTruncate doesn't check relpersistence of table.
(Index is OK.)

Please see the following sample.


[1] CREATE UNLOGGED TABLE

[1-1] Oid and Relfilenode

testdb=# CREATE UNLOGGED TABLE unlogged_table (c1 TEXT PRIMARY KEY);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"unlogged_table_pkey" for table "unlogged_table"
CREATE TABLE
testdb=# SELECT relname, oid, relfilenode FROM pg_class WHERE relname like
'unlogged%';
       relname       |  oid  | relfilenode
---------------------+-------+-------------
 unlogged_table      | 49808 |       49808
 unlogged_table_pkey | 49814 |       49814
(2 rows)

testdb=# SELECT relname, oid, relfilenode FROM pg_class WHERE relname like
'pg_toast_49808%';
       relname        |  oid  | relfilenode
----------------------+-------+-------------
 pg_toast_49808       | 49811 |       49811
 pg_toast_49808_index | 49813 |       49813
(2 rows)

[1-2] Database Files

-rw------- 1 postgres postgres      0  May 10 11:31 49808        -- table
-rw------- 1 postgres postgres      0  May 10 11:31 49808_init
-rw------- 1 postgres postgres      0  May 10 11:31 49811        -- toast
table
-rw------- 1 postgres postgres      0  May 10 11:31 49811_init
-rw------- 1 postgres postgres   8192  May 10 11:31 49813        -- toast
index
-rw------- 1 postgres postgres   8192  May 10 11:31 49813_init
-rw------- 1 postgres postgres   8192  May 10 11:31 49814        -- primary
key
-rw------- 1 postgres postgres   8192  May 10 11:31 49814_init


[2] TRUNCATE

[2-1] Oid and Relfilenode

testdb=# TRUNCATE unlogged_table;
TRUNCATE TABLE
testdb=# SELECT relname, oid, relfilenode FROM pg_class WHERE relname like
'unlogged%';
       relname       |  oid  | relfilenode
---------------------+-------+-------------
 unlogged_table      | 49808 |       49816
 unlogged_table_pkey | 49814 |       49818
(2 rows)

testdb=# SELECT relname, oid, relfilenode FROM pg_class WHERE relname like
'pg_toast_49808%';
       relname        |  oid  | relfilenode
----------------------+-------+-------------
 pg_toast_49808       | 49811 |       49817
 pg_toast_49808_index | 49813 |       49819
(2 rows)

[2-2] Database Files

-rw------- 1 postgres postgres      0  May 10 11:41 49816        -- table
-rw------- 1 postgres postgres      0  May 10 11:41 49817        -- toast
table
-rw------- 1 postgres postgres   8192  May 10 11:41 49818        -- primary
key
-rw------- 1 postgres postgres   8192  May 10 11:41 49818_init
-rw------- 1 postgres postgres   8192  May 10 11:41 49819        -- toast
index
-rw------- 1 postgres postgres   8192  May 10 11:41 49819_init




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #6635: TRUNCATE didn't recreate init fork.
  2012-05-10 05:32 BUG #6635: TRUNCATE didn't recreate init fork. kurosawa-akira@mxc.nes.nec.co.jp
@ 2012-05-11 13:50 ` Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Haas @ 2012-05-11 13:50 UTC (permalink / raw)
  To: kurosawa-akira@mxc.nes.nec.co.jp; +Cc: pgsql-bugs

On Thu, May 10, 2012 at 1:32 AM,  <kurosawa-akira@mxc.nes.nec.co.jp> wrote:
> When I executed TRUNCATE command to unlogged table,
> init fork of new relfilenode (include toast) wasn't created.

Fixed, thanks for the report!

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2012-05-11 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-05-10 05:32 BUG #6635: TRUNCATE didn't recreate init fork. kurosawa-akira@mxc.nes.nec.co.jp
2012-05-11 13:50 ` Robert Haas <robertmhaas@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox