From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [RFC] indirect toast tuple support |
Date: | 2013-02-16 17:22:10 |
Message-ID: | 20130216172210.GB15069@awork2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2013-02-16 17:47:31 | Re: BUG #7873: pg_restore --clean tries to drop tables that don't exist |
Previous Message | Andrew Dunstan | 2013-02-16 16:57:37 | Re: JSON Function Bike Shedding |