mirror of
https://github.com/postgres/postgres.git
synced 2025-12-02 23:42:46 +03:00
Support varlena fields with single-byte headers and unaligned storage.
This commit breaks any code that assumes that the mere act of forming a tuple (without writing it to disk) does not "toast" any fields. While all available regression tests pass, I'm not totally sure that we've fixed every nook and cranny, especially in contrib. Greg Stark with some help from Tom Lane
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.105 2007/03/27 23:21:10 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.106 2007/04/06 04:21:43 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1962,7 +1962,7 @@ struct varlena *
|
||||
pg_detoast_datum(struct varlena * datum)
|
||||
{
|
||||
if (VARATT_IS_EXTENDED(datum))
|
||||
return (struct varlena *) heap_tuple_untoast_attr((varattrib *) datum);
|
||||
return heap_tuple_untoast_attr(datum);
|
||||
else
|
||||
return datum;
|
||||
}
|
||||
@@ -1971,7 +1971,7 @@ struct varlena *
|
||||
pg_detoast_datum_copy(struct varlena * datum)
|
||||
{
|
||||
if (VARATT_IS_EXTENDED(datum))
|
||||
return (struct varlena *) heap_tuple_untoast_attr((varattrib *) datum);
|
||||
return heap_tuple_untoast_attr(datum);
|
||||
else
|
||||
{
|
||||
/* Make a modifiable copy of the varlena object */
|
||||
@@ -1987,7 +1987,16 @@ struct varlena *
|
||||
pg_detoast_datum_slice(struct varlena * datum, int32 first, int32 count)
|
||||
{
|
||||
/* Only get the specified portion from the toast rel */
|
||||
return (struct varlena *) heap_tuple_untoast_attr_slice((varattrib *) datum, first, count);
|
||||
return heap_tuple_untoast_attr_slice(datum, first, count);
|
||||
}
|
||||
|
||||
struct varlena *
|
||||
pg_detoast_datum_packed(struct varlena * datum)
|
||||
{
|
||||
if (VARATT_IS_COMPRESSED(datum) || VARATT_IS_EXTERNAL(datum))
|
||||
return heap_tuple_untoast_attr(datum);
|
||||
else
|
||||
return datum;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user