|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.59 2005/11/22 18:17:06 momjian Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.60 2006/01/06 00:15:50 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -281,10 +281,17 @@ RelationGetBufferForTuple(Relation relation, Size len,
|
281 | 281 | UnlockRelationForExtension(relation,ExclusiveLock);
|
282 | 282 |
|
283 | 283 | /*
|
284 |
| - * We need to initialize the empty new page. |
| 284 | + * We need to initialize the empty new page. Double-check that it really |
| 285 | + * is empty (this should never happen, but if it does we don't want to |
| 286 | + * risk wiping out valid data). |
285 | 287 | */
|
286 | 288 | pageHeader= (Page)BufferGetPage(buffer);
|
287 |
| -Assert(PageIsNew((PageHeader)pageHeader)); |
| 289 | + |
| 290 | +if (!PageIsNew((PageHeader)pageHeader)) |
| 291 | +elog(ERROR,"page %u of relation \"%s\" should be empty but is not", |
| 292 | +BufferGetBlockNumber(buffer), |
| 293 | +RelationGetRelationName(relation)); |
| 294 | + |
288 | 295 | PageInit(pageHeader,BufferGetPageSize(buffer),0);
|
289 | 296 |
|
290 | 297 | if (len>PageGetFreeSpace(pageHeader))
|
|