I have written a patch to issue an hint if someone tries to create a
function in a language that isn't loaded into the database:

        test=> CREATE FUNCTION xx() RETURNS INT AS '
        test'> select 1'
        test-> LANGUAGE 'plpgsql';
        ERROR:  language "plpgsql" does not exist
        HINT:  Perhaps you need to use 'createlang' to load the language into
        the database.

I know Peter didn't like this idea in the past, but we are getting too
many people who forget createlang, and with our new HINT tags, it seems
appropriate.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/commands/functioncmds.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/commands/functioncmds.c,v
retrieving revision 1.33
diff -c -c -r1.33 functioncmds.c
*** src/backend/commands/functioncmds.c 4 Aug 2003 02:39:58 -0000       1.33
--- src/backend/commands/functioncmds.c 4 Sep 2003 23:08:06 -0000
***************
*** 437,443 ****
        if (!HeapTupleIsValid(languageTuple))
                ereport(ERROR,
                                (errcode(ERRCODE_UNDEFINED_OBJECT),
!                                errmsg("language \"%s\" does not exist", 
languageName)));
  
        languageOid = HeapTupleGetOid(languageTuple);
        languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
--- 437,444 ----
        if (!HeapTupleIsValid(languageTuple))
                ereport(ERROR,
                                (errcode(ERRCODE_UNDEFINED_OBJECT),
!                                errmsg("language \"%s\" does not exist", 
languageName),
!                                errhint("Perhaps you need to use 'createlang' to load 
the language into the database.")));
  
        languageOid = HeapTupleGetOid(languageTuple);
        languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to