Bruce Momjian <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to