Re: Obsolete reference to _bt_tuplecompare() within tuplesort.c

Lists: pgsql-hackers
From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Obsolete reference to _bt_tuplecompare() within tuplesort.c
Date: 2014-10-09 23:04:30
Message-ID: CAM3SWZSjGCor8tQ8XsT=Ya0r2tMx01irzCzCzOiUhLv3pSMg8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I found a reference made obsolete by commit 9e85183b, which is from
way back in 2000.

comparetup_index_btree() says:

/*
* This is similar to _bt_tuplecompare(), but we have already done the
* index_getattr calls for the first column, and we need to keep track of
* whether any null fields are present. Also see the special treatment
* for equal keys at the end.
*/

I think that this comment should simply indicate that the routine is
similar to comparetup_heap(), except that it takes care of the special
tie-break stuff for B-Tree sorts, as well as enforcing uniqueness
during unique index builds. It should not reference _bt_compare() at
all (which is arguably the successor to _bt_tuplecompare()), since
_bt_compare() is concerned with a bunch of stuff highly specific to
the B-Tree implementation (e.g. having a hard-wired return value for
comparisons involving the first data item on an internal page).

--
Peter Geoghegan


From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Obsolete reference to _bt_tuplecompare() within tuplesort.c
Date: 2014-10-10 06:58:30
Message-ID: 54378396.9040401@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10/10/2014 02:04 AM, Peter Geoghegan wrote:
> I found a reference made obsolete by commit 9e85183b, which is from
> way back in 2000.
>
> comparetup_index_btree() says:
>
> /*
> * This is similar to _bt_tuplecompare(), but we have already done the
> * index_getattr calls for the first column, and we need to keep track of
> * whether any null fields are present. Also see the special treatment
> * for equal keys at the end.
> */
>
> I think that this comment should simply indicate that the routine is
> similar to comparetup_heap(), except that it takes care of the special
> tie-break stuff for B-Tree sorts, as well as enforcing uniqueness
> during unique index builds. It should not reference _bt_compare() at
> all (which is arguably the successor to _bt_tuplecompare()), since
> _bt_compare() is concerned with a bunch of stuff highly specific to
> the B-Tree implementation (e.g. having a hard-wired return value for
> comparisons involving the first data item on an internal page).

Yeah. Want to write that into a patch?

- Heikki


From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Obsolete reference to _bt_tuplecompare() within tuplesort.c
Date: 2014-10-10 07:33:08
Message-ID: CAM3SWZT+OVMi7OAdz3Yc9F2LP7w9BDcVUeZGgTmA8QgyEZXb8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Oct 9, 2014 at 11:58 PM, Heikki Linnakangas
<hlinnakangas(at)vmware(dot)com> wrote:
> Yeah. Want to write that into a patch?

Attached.

--
Peter Geoghegan

Attachment Content-Type Size
obsolete_comment.diff text/plain 940 bytes

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Obsolete reference to _bt_tuplecompare() within tuplesort.c
Date: 2014-10-19 08:29:09
Message-ID: CAM3SWZT8NqrGqsFiRo6QP_zGOQza-SCK9Zamx0BH5tFq1Z6R+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Oct 10, 2014 at 12:33 AM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
> Attached

Have you looked at this?

--
Peter Geoghegan


From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Obsolete reference to _bt_tuplecompare() within tuplesort.c
Date: 2014-10-22 13:02:50
Message-ID: 5447AAFA.9030500@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10/19/2014 11:29 AM, Peter Geoghegan wrote:
> On Fri, Oct 10, 2014 at 12:33 AM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
>> Attached
>
> Have you looked at this?

Committed now, thanks.

- Heikki