On 2013-02-16 17:42:31 +0100, Andres Freund wrote:
> +/* ----------
> + * toast_datum_differs -
> + *
> + *  Determine whether two toasted datums are the same and don't have to be
> + *  stored again.
> + * ----------
> + */
> +static bool
> +toast_datum_differs(struct varlena *old_value, struct varlena *new_value)
> +{
> +     Assert(VARATT_IS_EXTERNAL(old_value));
> +     Assert(VARATT_IS_EXTERNAL(new_value));
> +
> +     /* fast path for the common case where we have the toast oid available 
> */
> +     if (VARATT_IS_EXTERNAL_TOAST(old_value) &&
> +             VARATT_IS_EXTERNAL_TOAST(new_value))
> +             return memcmp((char *) old_value, (char *) new_value,
> +                                       VARSIZE_EXTERNAL(old_value)) == 0;
> ...
> +     /* compare payload, we're fine with unaligned data */
> +     return memcmp(VARDATA_ANY(old_value), VARDATA_ANY(new_value),
> +                               VARSIZE_ANY_EXHDR(old_value)) == 0;
> +}

Those == need to be !=. Comes from changing the meaning of a function
last minute without an easy way to test (it just uselessly emits a new
toast tuple when nothing changed).

Greetings,

Andres Freund

-- 
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to