Discussion:
Obsolete reference to _bt_tuplecompare() within tuplesort.c
Peter Geoghegan
2014-10-09 23:04:30 UTC
Permalink
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
--
Sent via pgsql-hackers mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Heikki Linnakangas
2014-10-10 06:58:30 UTC
Permalink
Post by Peter Geoghegan
I found a reference made obsolete by commit 9e85183b, which is from
way back in 2000.
/*
* 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
--
Sent via pgsql-hackers mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Peter Geoghegan
2014-10-10 07:33:08 UTC
Permalink
On Thu, Oct 9, 2014 at 11:58 PM, Heikki Linnakangas
Post by Heikki Linnakangas
Yeah. Want to write that into a patch?
Attached.
--
Peter Geoghegan
Peter Geoghegan
2014-10-19 08:29:09 UTC
Permalink
Post by Peter Geoghegan
Attached
Have you looked at this?
--
Peter Geoghegan
--
Sent via pgsql-hackers mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Heikki Linnakangas
2014-10-22 13:02:50 UTC
Permalink
Post by Peter Geoghegan
Post by Peter Geoghegan
Attached
Have you looked at this?
Committed now, thanks.

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