8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.87 2008/04/17 21:37:28 alvherre Exp $
11
+ * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.88 2008/06/13 02:59:47 tgl Exp $
12
12
*
13
13
*
14
14
* INTERFACE ROUTINES
@@ -1216,8 +1216,6 @@ toast_save_datum(Relation rel, Datum value,
1216
1216
SET_VARSIZE (& chunk_data , chunk_size + VARHDRSZ );
1217
1217
memcpy (VARDATA (& chunk_data ), data_p , chunk_size );
1218
1218
toasttup = heap_form_tuple (toasttupDesc , t_values , t_isnull );
1219
- if (!HeapTupleIsValid (toasttup ))
1220
- elog (ERROR , "failed to build TOAST tuple" );
1221
1219
1222
1220
heap_insert (toastrel , toasttup , mycid , use_wal , use_fsm );
1223
1221
@@ -1412,7 +1410,9 @@ toast_fetch_datum(struct varlena * attr)
1412
1410
else
1413
1411
{
1414
1412
/* should never happen */
1415
- elog (ERROR , "found toasted toast chunk" );
1413
+ elog (ERROR , "found toasted toast chunk for toast value %u in %s" ,
1414
+ toast_pointer .va_valueid ,
1415
+ RelationGetRelationName (toastrel ));
1416
1416
chunksize = 0 ; /* keep compiler quiet */
1417
1417
chunkdata = NULL ;
1418
1418
}
@@ -1421,31 +1421,35 @@ toast_fetch_datum(struct varlena * attr)
1421
1421
* Some checks on the data we've found
1422
1422
*/
1423
1423
if (residx != nextidx )
1424
- elog (ERROR , "unexpected chunk number %d (expected %d) for toast value %u" ,
1424
+ elog (ERROR , "unexpected chunk number %d (expected %d) for toast value %u in %s " ,
1425
1425
residx , nextidx ,
1426
- toast_pointer .va_valueid );
1426
+ toast_pointer .va_valueid ,
1427
+ RelationGetRelationName (toastrel ));
1427
1428
if (residx < numchunks - 1 )
1428
1429
{
1429
1430
if (chunksize != TOAST_MAX_CHUNK_SIZE )
1430
- elog (ERROR , "unexpected chunk size %d (expected %d) in chunk %d of %d for toast value %u" ,
1431
+ elog (ERROR , "unexpected chunk size %d (expected %d) in chunk %d of %d for toast value %u in %s " ,
1431
1432
chunksize , (int ) TOAST_MAX_CHUNK_SIZE ,
1432
1433
residx , numchunks ,
1433
- toast_pointer .va_valueid );
1434
+ toast_pointer .va_valueid ,
1435
+ RelationGetRelationName (toastrel ));
1434
1436
}
1435
1437
else if (residx == numchunks - 1 )
1436
1438
{
1437
1439
if ((residx * TOAST_MAX_CHUNK_SIZE + chunksize ) != ressize )
1438
- elog (ERROR , "unexpected chunk size %d (expected %d) in final chunk %d for toast value %u" ,
1440
+ elog (ERROR , "unexpected chunk size %d (expected %d) in final chunk %d for toast value %u in %s " ,
1439
1441
chunksize ,
1440
1442
(int ) (ressize - residx * TOAST_MAX_CHUNK_SIZE ),
1441
1443
residx ,
1442
- toast_pointer .va_valueid );
1444
+ toast_pointer .va_valueid ,
1445
+ RelationGetRelationName (toastrel ));
1443
1446
}
1444
1447
else
1445
- elog (ERROR , "unexpected chunk number %d for toast value %u (out of range %d..%d)" ,
1448
+ elog (ERROR , "unexpected chunk number %d (out of range %d..%d) for toast value %u in %s " ,
1446
1449
residx ,
1450
+ 0 , numchunks - 1 ,
1447
1451
toast_pointer .va_valueid ,
1448
- 0 , numchunks - 1 );
1452
+ RelationGetRelationName ( toastrel ) );
1449
1453
1450
1454
/*
1451
1455
* Copy the data into proper place in our result
@@ -1461,9 +1465,10 @@ toast_fetch_datum(struct varlena * attr)
1461
1465
* Final checks that we successfully fetched the datum
1462
1466
*/
1463
1467
if (nextidx != numchunks )
1464
- elog (ERROR , "missing chunk number %d for toast value %u" ,
1468
+ elog (ERROR , "missing chunk number %d for toast value %u in %s " ,
1465
1469
nextidx ,
1466
- toast_pointer .va_valueid );
1470
+ toast_pointer .va_valueid ,
1471
+ RelationGetRelationName (toastrel ));
1467
1472
1468
1473
/*
1469
1474
* End scan and close relations
@@ -1621,7 +1626,9 @@ toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length)
1621
1626
else
1622
1627
{
1623
1628
/* should never happen */
1624
- elog (ERROR , "found toasted toast chunk" );
1629
+ elog (ERROR , "found toasted toast chunk for toast value %u in %s" ,
1630
+ toast_pointer .va_valueid ,
1631
+ RelationGetRelationName (toastrel ));
1625
1632
chunksize = 0 ; /* keep compiler quiet */
1626
1633
chunkdata = NULL ;
1627
1634
}
@@ -1630,31 +1637,35 @@ toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length)
1630
1637
* Some checks on the data we've found
1631
1638
*/
1632
1639
if ((residx != nextidx ) || (residx > endchunk ) || (residx < startchunk ))
1633
- elog (ERROR , "unexpected chunk number %d (expected %d) for toast value %u" ,
1640
+ elog (ERROR , "unexpected chunk number %d (expected %d) for toast value %u in %s " ,
1634
1641
residx , nextidx ,
1635
- toast_pointer .va_valueid );
1642
+ toast_pointer .va_valueid ,
1643
+ RelationGetRelationName (toastrel ));
1636
1644
if (residx < totalchunks - 1 )
1637
1645
{
1638
1646
if (chunksize != TOAST_MAX_CHUNK_SIZE )
1639
- elog (ERROR , "unexpected chunk size %d (expected %d) in chunk %d of %d for toast value %u when fetching slice" ,
1647
+ elog (ERROR , "unexpected chunk size %d (expected %d) in chunk %d of %d for toast value %u in %s when fetching slice" ,
1640
1648
chunksize , (int ) TOAST_MAX_CHUNK_SIZE ,
1641
1649
residx , totalchunks ,
1642
- toast_pointer .va_valueid );
1650
+ toast_pointer .va_valueid ,
1651
+ RelationGetRelationName (toastrel ));
1643
1652
}
1644
1653
else if (residx == totalchunks - 1 )
1645
1654
{
1646
1655
if ((residx * TOAST_MAX_CHUNK_SIZE + chunksize ) != attrsize )
1647
- elog (ERROR , "unexpected chunk size %d (expected %d) in final chunk %d for toast value %u when fetching slice" ,
1656
+ elog (ERROR , "unexpected chunk size %d (expected %d) in final chunk %d for toast value %u in %s when fetching slice" ,
1648
1657
chunksize ,
1649
1658
(int ) (attrsize - residx * TOAST_MAX_CHUNK_SIZE ),
1650
1659
residx ,
1651
- toast_pointer .va_valueid );
1660
+ toast_pointer .va_valueid ,
1661
+ RelationGetRelationName (toastrel ));
1652
1662
}
1653
1663
else
1654
- elog (ERROR , "unexpected chunk number %d for toast value %u (out of range %d..%d)" ,
1664
+ elog (ERROR , "unexpected chunk number %d (out of range %d..%d) for toast value %u in %s " ,
1655
1665
residx ,
1666
+ 0 , totalchunks - 1 ,
1656
1667
toast_pointer .va_valueid ,
1657
- 0 , totalchunks - 1 );
1668
+ RelationGetRelationName ( toastrel ) );
1658
1669
1659
1670
/*
1660
1671
* Copy the data into proper place in our result
@@ -1678,9 +1689,10 @@ toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length)
1678
1689
* Final checks that we successfully fetched the datum
1679
1690
*/
1680
1691
if (nextidx != (endchunk + 1 ))
1681
- elog (ERROR , "missing chunk number %d for toast value %u" ,
1692
+ elog (ERROR , "missing chunk number %d for toast value %u in %s " ,
1682
1693
nextidx ,
1683
- toast_pointer .va_valueid );
1694
+ toast_pointer .va_valueid ,
1695
+ RelationGetRelationName (toastrel ));
1684
1696
1685
1697
/*
1686
1698
* End scan and close relations
0 commit comments