<listitem>
<para>
- The name of the new procedural language. The language name is
- case insensitive. The name must be unique among the languages
- in the database.
+ The name of the new procedural language.
+ The name must be unique among the languages in the database.
</para>
<para>
#include "parser/scansup.h"
#include "utils/int8.h"
-
-/*
- * Translate the input language name to lower case, and truncate if needed.
- *
- * Returns a palloc'd string
- */
-char *
-case_translate_language_name(const char *input)
-{
- return downcase_truncate_identifier(input, strlen(input), false);
-}
-
-
/*
* Extract a string value (otherwise uninterpreted) from a DefElem.
*/
Oid prorettype;
bool returnsSet;
char *language;
- char *languageName;
Oid languageOid;
Oid languageValidator;
char *funcname;
&isStrict, &security,
&proconfig, &procost, &prorows);
- /* Convert language name to canonical case */
- languageName = case_translate_language_name(language);
-
/* Look up the language and validate permissions */
- languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(languageName));
+ languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(language));
if (!HeapTupleIsValid(languageTuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("language \"%s\" does not exist", languageName),
- (PLTemplateExists(languageName) ?
+ errmsg("language \"%s\" does not exist", language),
+ (PLTemplateExists(language) ?
errhint("Use CREATE LANGUAGE to load the language into the database.") : 0)));
languageOid = HeapTupleGetOid(languageTuple);
compute_attributes_with_style(stmt->withClause, &isStrict, &volatility);
- interpret_AS_clause(languageOid, languageName, funcname, as_clause,
+ interpret_AS_clause(languageOid, language, funcname, as_clause,
&prosrc_str, &probin_str);
/*
DefElem *as_item = NULL;
DefElem *language_item = NULL;
char *language;
- char *languageName;
Oid laninline;
HeapTuple languageTuple;
Form_pg_language languageStruct;
else
language = "plpgsql";
- /* Convert language name to canonical case */
- languageName = case_translate_language_name(language);
-
/* Look up the language and validate permissions */
- languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(languageName));
+ languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(language));
if (!HeapTupleIsValid(languageTuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("language \"%s\" does not exist", languageName),
- (PLTemplateExists(languageName) ?
+ errmsg("language \"%s\" does not exist", language),
+ (PLTemplateExists(language) ?
errhint("Use CREATE LANGUAGE to load the language into the database.") : 0)));
codeblock->langOid = HeapTupleGetOid(languageTuple);
void
CreateProceduralLanguage(CreatePLangStmt *stmt)
{
- char *languageName;
PLTemplate *pltemplate;
Oid handlerOid,
inlineOid,
Oid funcrettype;
Oid funcargtypes[1];
- /*
- * Translate the language name to lower case
- */
- languageName = case_translate_language_name(stmt->plname);
-
/*
* If we have template information for the language, ignore the supplied
* parameters (if any) and use the template information.
*/
- if ((pltemplate = find_language_template(languageName)) != NULL)
+ if ((pltemplate = find_language_template(stmt->plname)) != NULL)
{
List *funcname;
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to create procedural language \"%s\"",
- languageName)));
+ stmt->plname)));
if (!pg_database_ownercheck(MyDatabaseId, GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE,
get_database_name(MyDatabaseId));
valOid = InvalidOid;
/* ok, create it */
- create_proc_lang(languageName, stmt->replace, GetUserId(),
+ create_proc_lang(stmt->plname, stmt->replace, GetUserId(),
handlerOid, inlineOid,
valOid, pltemplate->tmpltrusted);
}
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("unsupported language \"%s\"",
- languageName),
+ stmt->plname),
errhint("The supported languages are listed in the pg_pltemplate system catalog.")));
/*
valOid = InvalidOid;
/* ok, create it */
- create_proc_lang(languageName, stmt->replace, GetUserId(),
+ create_proc_lang(stmt->plname, stmt->replace, GetUserId(),
handlerOid, inlineOid,
valOid, stmt->pltrusted);
}
void
DropProceduralLanguage(DropPLangStmt *stmt)
{
- char *languageName;
Oid oid;
ObjectAddress object;
- /*
- * Translate the language name, check that the language exists
- */
- languageName = case_translate_language_name(stmt->plname);
-
- oid = get_language_oid(languageName, stmt->missing_ok);
+ oid = get_language_oid(stmt->plname, stmt->missing_ok);
if (!OidIsValid(oid))
{
ereport(NOTICE,
(errmsg("language \"%s\" does not exist, skipping",
- languageName)));
+ stmt->plname)));
return;
}
*/
if (!pg_language_ownercheck(oid, GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_LANGUAGE,
- languageName);
+ stmt->plname);
object.classId = LanguageRelationId;
object.objectId = oid;
HeapTuple tup;
Relation rel;
- /* Translate both names for consistency with CREATE */
- oldname = case_translate_language_name(oldname);
- newname = case_translate_language_name(newname);
-
rel = heap_open(LanguageRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(LANGNAME, CStringGetDatum(oldname));
HeapTuple tup;
Relation rel;
- /* Translate name for consistency with CREATE */
- name = case_translate_language_name(name);
-
rel = heap_open(LanguageRelationId, RowExclusiveLock);
tup = SearchSysCache1(LANGNAME, CStringGetDatum(name));
/* support routines in commands/define.c */
-extern char *case_translate_language_name(const char *input);
-
extern char *defGetString(DefElem *def);
extern double defGetNumeric(DefElem *def);
extern bool defGetBoolean(DefElem *def);