Re: [PATCHES] Warning for missing createlang - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] Warning for missing createlang
Date
Msg-id 25137.1062779011@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCHES] Warning for missing createlang  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [PATCHES] Warning for missing createlang  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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 by date:

Previous
From: "Mendola Gaetano"
Date:
Subject: Re: C++ and using C functions
Next
From: Tom Lane
Date:
Subject: Re: 64-bit pgsql