* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.96 2005/11/22 18:17:06 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.97 2006/01/07 22:45:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
static void
_bt_blwritepage(BTWriteState *wstate, Page page, BlockNumber blkno)
{
+ /* Ensure rd_smgr is open (could have been closed by relcache flush!) */
+ RelationOpenSmgr(wstate->index);
+
/* XLOG stuff */
if (wstate->btws_use_wal)
{
* occurs.
*/
if (!wstate->index->rd_istemp)
+ {
+ RelationOpenSmgr(wstate->index);
smgrimmedsync(wstate->index->rd_smgr);
+ }
}