]> granicus.if.org Git - postgresql/commitdiff
Add HINT if CREATE FUNCTION specifies a valid language, but the language
authorBruce Momjian <bruce@momjian.us>
Wed, 10 Sep 2003 19:59:23 +0000 (19:59 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 10 Sep 2003 19:59:23 +0000 (19:59 +0000)
isn't loaded into the database.

src/backend/commands/functioncmds.c

index a47820d2314a6c7188e387f380e21826ec88343d..ea5ba1031317e00c5c9d2bea1ce77c500543dee5 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.33 2003/08/04 02:39:58 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.34 2003/09/10 19:59:23 momjian Exp $
  *
  * DESCRIPTION
  *       These routines take the parse tree and pick out the
@@ -435,10 +435,23 @@ CreateFunction(CreateFunctionStmt *stmt)
                                                                   PointerGetDatum(languageName),
                                                                   0, 0, 0);
        if (!HeapTupleIsValid(languageTuple))
+               /* Add any new languages to this list to invoke the hint. */
                ereport(ERROR,
                                (errcode(ERRCODE_UNDEFINED_OBJECT),
-                                errmsg("language \"%s\" does not exist", languageName)));
-
+                                errmsg("language \"%s\" does not exist", languageName),
+                                  (strcmp(languageName, "plperl") == 0 ||
+                                       strcmp(languageName, "plperlu") == 0 ||
+                                       strcmp(languageName, "plphp") == 0 ||
+                                       strcmp(languageName, "plpgsql") == 0 ||
+                                       strcmp(languageName, "plpython") == 0 ||
+                                       strcmp(languageName, "plpythonu") == 0 ||
+                                       strcmp(languageName, "plr") == 0 ||
+                                       strcmp(languageName, "plruby") == 0 ||
+                                       strcmp(languageName, "plsh") == 0 ||
+                                       strcmp(languageName, "pltcl") == 0 ||
+                                       strcmp(languageName, "pltclu") == 0) ?
+                                errhint("You need to use 'createlang' to load the language into the database.") : 0));
+       
        languageOid = HeapTupleGetOid(languageTuple);
        languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);