Re: pgsql: Get rid of pg_class.reltoastidxid.

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Fujii Masao <fujii(at)postgresql(dot)org>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Get rid of pg_class.reltoastidxid.
Date: 2014-01-15 12:54:34
Message-ID: CAB7nPqSp0R+zmTKXNy1P_8dnLNLv3-B9hpqJkzzki4dWiOZUGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Wed, Jan 15, 2014 at 9:29 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> Hi Fujii, Michael,
>
> Coverity indicated that there's a problem with this - a quick look
> confirms that:
>
> foreach(lc, indexlist)
> (*toastidxs)[i++] = index_open(lfirst_oid(lc), lock);
>
> /* Fetch the first valid index in list */
> for (i = 0; i < *num_indexes; i++)
> {
> Relation toastidx = *toastidxs[i];
> if (toastidx->rd_index->indisvalid)
> {
> res = i;
> found = true;
> break;
> }
> }
>
> Note how the second access to toastidxs is missing parentheses. It
> should be (*toastidxs)[i].
>
> I think this happens to mostly work because usually the older index will
> still be valid when we open the toast indexes when there are multiple
> ones and RelationGetIndexList() returns indexes in toast order.
Oops, good catch. If someone could show up and commit the attached to
master and REL9_3_STABLE...
Regards,
--
Michael

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2014-01-15 13:02:49 Re: pgsql: Get rid of pg_class.reltoastidxid.
Previous Message Andres Freund 2014-01-15 12:29:48 Re: pgsql: Get rid of pg_class.reltoastidxid.