Commit d16b8776 authored by Bruce Momjian's avatar Bruce Momjian

Add HINT if CREATE FUNCTION specifies a valid language, but the language

isn't loaded into the database.
parent a72fce03
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 * DESCRIPTION
* These routines take the parse tree and pick out the * These routines take the parse tree and pick out the
...@@ -435,10 +435,23 @@ CreateFunction(CreateFunctionStmt *stmt) ...@@ -435,10 +435,23 @@ CreateFunction(CreateFunctionStmt *stmt)
PointerGetDatum(languageName), PointerGetDatum(languageName),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(languageTuple)) if (!HeapTupleIsValid(languageTuple))
/* Add any new languages to this list to invoke the hint. */
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), (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); languageOid = HeapTupleGetOid(languageTuple);
languageStruct = (Form_pg_language) GETSTRUCT(languageTuple); languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment