From 48123de71792c367313542883f0e9df7d850c994 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 8 Sep 2005 20:07:42 +0000 Subject: Create the pg_pltemplate system catalog to hold template information for procedural languages. This replaces the hard-wired table I had originally proposed as a stopgap solution. For the moment, the initial contents only include languages shipped with the core distribution. --- src/backend/commands/functioncmds.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/backend/commands/functioncmds.c') diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index d6bb902274e..c2bb4a2d9c8 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.66 2005/08/22 17:38:20 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.67 2005/09/08 20:07:41 tgl Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the @@ -44,6 +44,7 @@ #include "catalog/pg_proc.h" #include "catalog/pg_type.h" #include "commands/defrem.h" +#include "commands/proclang.h" #include "miscadmin.h" #include "optimizer/cost.h" #include "parser/parse_func.h" @@ -543,17 +544,11 @@ 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), - (strcmp(languageName, "plperl") == 0 || - strcmp(languageName, "plperlu") == 0 || - strcmp(languageName, "plpgsql") == 0 || - strcmp(languageName, "plpythonu") == 0 || - strcmp(languageName, "pltcl") == 0 || - strcmp(languageName, "pltclu") == 0) ? - errhint("You need to use \"createlang\" to load the language into the database.") : 0)); + (PLTemplateExists(languageName) ? + errhint("Use CREATE LANGUAGE to load the language into the database.") : 0))); languageOid = HeapTupleGetOid(languageTuple); languageStruct = (Form_pg_language) GETSTRUCT(languageTuple); -- cgit v1.2.3