Are range_before and range_after commutator operators?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>, Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Are range_before and range_after commutator operators?
Date: 2011-11-16 22:53:37
Message-ID: 21850.1321484017@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I noticed that << and >> are not marked as commutator operators,
though a naive view of their semantics suggests they should be.
However, I realized that there might be edge cases I wasn't thinking
about, so I went looking in the patch to try to confirm this. And
I found neither a single line of documentation about it, nor a single
comment in that hairy little nest of unobvious tests that calls itself
range_cmp_bounds. I am of the opinion that that routine not only
requires a comment, but very possibly a comment longer than the routine
itself. What's more, if it's this complicated to code, surely it would
be a good idea for the user-facing documentation to explain exactly
what we think before/after mean?

In general, the level of commenting in the rangetypes code seems far short
of what I'd consider acceptable for Postgres code. I plan to fix some
of that myself, but I do not wish to reverse-engineer what the heck
range_cmp_bounds thinks it's doing.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Jaskiewicz 2011-11-16 23:45:24 Re: Configuration include directory
Previous Message Simon Riggs 2011-11-16 22:15:29 Re: Minor optimisation of XLogInsert()