aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-02-03 10:01:30 +0000
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-02-03 10:01:30 +0000
commit9de778b24b7d4040a385486348904db1bf69f677 (patch)
tree575b906bda0ed9b86a52480cefdff773eadb3a42 /src/backend/commands/tablecmds.c
parent808969d0e7ac2d2fdbd915c6a6ac9ec68b6f63f9 (diff)
downloadpostgresql-9de778b24b7d4040a385486348904db1bf69f677.tar.gz
postgresql-9de778b24b7d4040a385486348904db1bf69f677.zip
Move the responsibility of writing a "unlogged WAL operation" record from
heap_sync() to the callers, because heap_sync() is sometimes called even if the operation itself is WAL-logged. This eliminates the bogus unlogged records from CLUSTER that Simon Riggs reported, patch by Fujii Masao.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index cec3b7fc58e..a729adb0550 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.322 2010/02/03 01:14:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.323 2010/02/03 10:01:29 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3297,7 +3297,13 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap)
/* If we skipped writing WAL, then we need to sync the heap. */
if (hi_options & HEAP_INSERT_SKIP_WAL)
+ {
+ char reason[NAMEDATALEN + 30];
+ snprintf(reason, sizeof(reason), "table rewrite on \"%s\"",
+ RelationGetRelationName(newrel));
+ XLogReportUnloggedStatement(reason);
heap_sync(newrel);
+ }
heap_close(newrel, NoLock);
}