minor error message inconsistency in make_pathkey_from_sortinfo

Started by jian heover 1 year ago4 messages
#1jian he
jian.universality@gmail.com

hi.

in make_pathkey_from_sortinfo

equality_op = get_opfamily_member(opfamily,
opcintype,
opcintype,
BTEqualStrategyNumber);
if (!OidIsValid(equality_op)) /* shouldn't happen */
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
BTEqualStrategyNumber, opcintype, opcintype, opfamily);

the error message seems not right?

maybe
if (!OidIsValid(equality_op)) /* shouldn't happen */
elog(ERROR, "missing operator =(%u,%u) in opfamily %u",opcintype,
opcintype, opfamily);

or

if (!OidIsValid(equality_op)) /* shouldn't happen */
elog(ERROR, "missing equality operator for type %u in opfamily
%u",opcintype, opcintype, opfamily);

#2Yugo NAGATA
nagata@sraoss.co.jp
In reply to: jian he (#1)
Re: minor error message inconsistency in make_pathkey_from_sortinfo

On Wed, 24 Apr 2024 15:05:00 +0800
jian he <jian.universality@gmail.com> wrote:

hi.

in make_pathkey_from_sortinfo

equality_op = get_opfamily_member(opfamily,
opcintype,
opcintype,
BTEqualStrategyNumber);
if (!OidIsValid(equality_op)) /* shouldn't happen */
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
BTEqualStrategyNumber, opcintype, opcintype, opfamily);

the error message seems not right?

This message was introduced by 278cb434110 which was aiming to
standardize the wording for similar errors. We can find the pattern

"missing {support function | operator} %d(%u,%u) in opfamily %u"

in several places.

Regards,
Yugo Nagata

maybe
if (!OidIsValid(equality_op)) /* shouldn't happen */
elog(ERROR, "missing operator =(%u,%u) in opfamily %u",opcintype,
opcintype, opfamily);

or

if (!OidIsValid(equality_op)) /* shouldn't happen */
elog(ERROR, "missing equality operator for type %u in opfamily
%u",opcintype, opcintype, opfamily);

--
Yugo NAGATA <nagata@sraoss.co.jp>

#3jian he
jian.universality@gmail.com
In reply to: Yugo NAGATA (#2)
Re: minor error message inconsistency in make_pathkey_from_sortinfo

On Wed, Apr 24, 2024 at 5:47 PM Yugo NAGATA <nagata@sraoss.co.jp> wrote:

On Wed, 24 Apr 2024 15:05:00 +0800
jian he <jian.universality@gmail.com> wrote:

hi.

in make_pathkey_from_sortinfo

equality_op = get_opfamily_member(opfamily,
opcintype,
opcintype,
BTEqualStrategyNumber);
if (!OidIsValid(equality_op)) /* shouldn't happen */
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
BTEqualStrategyNumber, opcintype, opcintype, opfamily);

the error message seems not right?

This message was introduced by 278cb434110 which was aiming to
standardize the wording for similar errors. We can find the pattern

"missing {support function | operator} %d(%u,%u) in opfamily %u"

in several places.

the error message
` operator %d`
would translate to
` operator 3`

but there is oid as 3 operator in the catalog.
that's my confusion.
the discussion at [1]/messages/by-id/CAGPqQf2R9Nk8htpv0FFi+FP776EwMyGuORpc9zYkZKC8sFQE3g@mail.gmail.com didn't explain my confusion.

[1]: /messages/by-id/CAGPqQf2R9Nk8htpv0FFi+FP776EwMyGuORpc9zYkZKC8sFQE3g@mail.gmail.com

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: jian he (#3)
Re: minor error message inconsistency in make_pathkey_from_sortinfo

jian he <jian.universality@gmail.com> writes:

On Wed, Apr 24, 2024 at 5:47 PM Yugo NAGATA <nagata@sraoss.co.jp> wrote:

This message was introduced by 278cb434110 which was aiming to
standardize the wording for similar errors. We can find the pattern
"missing {support function | operator} %d(%u,%u) in opfamily %u"
in several places.

the error message
` operator %d`
would translate to
` operator 3`

but there is oid as 3 operator in the catalog.
that's my confusion.

That number is the opclass' operator strategy number, not an OID
(which is why it's formatted as %d not %u). See

https://www.postgresql.org/docs/devel/xindex.html#XINDEX-STRATEGIES

regards, tom lane