Re: [PATCHES] Warning for missing createlang

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCHES] Warning for missing createlang
Дата
Msg-id 25137.1062779011@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCHES] Warning for missing createlang  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: [PATCHES] Warning for missing createlang  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> We could answer my objection about the hint popping out on misspelled
>> language names if the code were to arrange to put out the hint only when
>> the language name is one of "plpgsql", "pltcl", "pltclu", etc.  This
>> would have to use a hard-coded list of loadable language names, since
>> by definition looking in pg_language won't help.  It would be enough of
>> a maintenance PITA that I don't especially want to do it ... but it
>> would ensure that the hint is likely to be relevant.

> OK, new output is:

You forgot pltclu, and I believe plpython is now called plpythonu, and
I'm not sure whether there's a plperlu, and if you're going to include
outside-the-distro languages then I am pretty sure there's a plruby.
See what I mean about the maintenance headache this will cause?

BTW, duplicating the ereport is no fun.  I'd suggest the coding style
used in some other places, with errhint called in a conditional
expression:
           ereport(ERROR,                   (errcode(ERRCODE_UNDEFINED_OBJECT),                    errmsg("language
\"%s\"does not exist", languageName),         known_language(languageName) ?                    errhint("You need to
use'createlang' to load the language into the database.") : 0));
 

where known_language() is a little subroutine that has the strcmp()s.
        regards, tom lane


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

Предыдущее
От: "Mendola Gaetano"
Дата:
Сообщение: Re: C++ and using C functions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: 64-bit pgsql