Don't like getObjectDescription results for pg_amop/pg_amproc

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Don't like getObjectDescription results for pg_amop/pg_amproc
Дата
Msg-id 31599.1565824065@sss.pgh.pa.us
обсуждение исходный текст
Ответы Re: Don't like getObjectDescription results for pg_amop/pg_amproc  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Список pgsql-hackers
I notice that for a pg_amop object, getObjectDescription does this:

                /*------
                   translator: %d is the operator strategy (a number), the
                   first two %s's are data type names, the third %s is the
                   description of the operator family, and the last %s is the
                   textual form of the operator with arguments.  */
                appendStringInfo(&buffer, _("operator %d (%s, %s) of %s: %s"),
                                 amopForm->amopstrategy,
                                 format_type_be(amopForm->amoplefttype),
                                 format_type_be(amopForm->amoprighttype),
                                 opfam.data,
                                 format_operator(amopForm->amopopr));

This might seem all right in isolation, but it produces completely horrid
results as soon as you plug it into some larger message.  For example,

contrib_regression=# alter operator family gin__int_ops using gin drop operator  8 (integer[],integer[]);
ERROR:  cannot drop operator 8 (integer[], integer[]) of operator family gin__int_ops for access method gin:
<@(integer[],integer[])because operator class gin__int_ops for access method gin requires it 
HINT:  You can drop operator class gin__int_ops for access method gin instead.

The colon seems like it ought to introduce a subsidiary sentence, but
it does not, and the reader is led off into the weeds trying to figure
out what connects to what.

I follow the point of trying to show the actual operator name, but
we gotta work harder on the presentation.  Perhaps this would work:

                appendStringInfo(&buffer, _("operator %d (%s, %s) (that is, %s) of %s"),
                                 amopForm->amopstrategy,
                                 format_type_be(amopForm->amoplefttype),
                                 format_type_be(amopForm->amoprighttype),
                                 format_operator(amopForm->amopopr),
                                 opfam.data);

leading to

ERROR:  cannot drop operator 8 (integer[], integer[]) (that is, <@(integer[],integer[])) of operator family
gin__int_opsfor access method gin because operator class gin__int_ops for access method gin requires it 

Likewise for pg_amproc entries, of course.

Or maybe we're just being too ambitious here and we should discard some of
this information.  I'm not really sure that the format_operator result
can be included without complete loss of intelligibility.

Thoughts?  I'm particularly unclear on how any of this might translate
into other languages, though I doubt that the current text is giving
good guidance to translators.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: progress report for ANALYZE
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Add "password_protocol" connection parameter to libpq