Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 556110f

Browse files
committed
copy_relation_data was mistakenly assuming that the source relation
would always be already open at the smgr level. Per bug report from Fabien Coelho.
1 parent b4456e6 commit 556110f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/commands/tablecmds.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.129 2004/08/29 05:06:41 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.130 2004/08/31 15:56:39 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -5434,7 +5434,7 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace)
54345434
static void
54355435
copy_relation_data(Relation rel, SMgrRelation dst)
54365436
{
5437-
SMgrRelation src = rel->rd_smgr;
5437+
SMgrRelation src;
54385438
bool use_wal;
54395439
BlockNumber nblocks;
54405440
BlockNumber blkno;
@@ -5457,6 +5457,9 @@ copy_relation_data(Relation rel, SMgrRelation dst)
54575457
use_wal = XLogArchivingActive() && !rel->rd_istemp;
54585458

54595459
nblocks = RelationGetNumberOfBlocks(rel);
5460+
/* RelationGetNumberOfBlocks will certainly have opened rd_smgr */
5461+
src = rel->rd_smgr;
5462+
54605463
for (blkno = 0; blkno < nblocks; blkno++)
54615464
{
54625465
smgrread(src, blkno, buf);

0 commit comments

Comments
 (0)