Warning for missing createlang - Mailing list pgsql-patches

From Bruce Momjian
Subject Warning for missing createlang
Date
Msg-id 200309042309.h84N9nx11372@candle.pha.pa.us
Whole thread Raw
Responses Re: Warning for missing createlang
Re: Warning for missing createlang
List pgsql-patches
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
  pgman@candle.pha.pa.us               |  (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);

pgsql-patches by date:

Previous
From: Robert Treat
Date:
Subject: note on dropped columns in pg_attribute
Next
From: Neil Conway
Date:
Subject: minor documentation improvements