|
|
@ -7,7 +7,7 @@ |
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California |
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California |
|
|
|
* |
|
|
|
* |
|
|
|
* IDENTIFICATION |
|
|
|
* IDENTIFICATION |
|
|
|
* $Header: /cvsroot/pgsql/src/backend/commands/proclang.c,v 1.39 2002/08/05 03:29:17 tgl Exp $ |
|
|
|
* $Header: /cvsroot/pgsql/src/backend/commands/proclang.c,v 1.40 2002/08/13 17:22:08 petere Exp $ |
|
|
|
* |
|
|
|
* |
|
|
|
*------------------------------------------------------------------------- |
|
|
|
*------------------------------------------------------------------------- |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -56,7 +56,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) |
|
|
|
* Check permission |
|
|
|
* Check permission |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if (!superuser()) |
|
|
|
if (!superuser()) |
|
|
|
elog(ERROR, "Only users with Postgres superuser privilege are " |
|
|
|
elog(ERROR, "Only users with superuser privilege are " |
|
|
|
"permitted to create procedural languages"); |
|
|
|
"permitted to create procedural languages"); |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -77,10 +77,10 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) |
|
|
|
MemSet(typev, 0, sizeof(typev)); |
|
|
|
MemSet(typev, 0, sizeof(typev)); |
|
|
|
procOid = LookupFuncName(stmt->plhandler, 0, typev); |
|
|
|
procOid = LookupFuncName(stmt->plhandler, 0, typev); |
|
|
|
if (!OidIsValid(procOid)) |
|
|
|
if (!OidIsValid(procOid)) |
|
|
|
elog(ERROR, "PL handler function %s() doesn't exist", |
|
|
|
elog(ERROR, "function %s() doesn't exist", |
|
|
|
NameListToString(stmt->plhandler)); |
|
|
|
NameListToString(stmt->plhandler)); |
|
|
|
if (get_func_rettype(procOid) != InvalidOid) |
|
|
|
if (get_func_rettype(procOid) != InvalidOid) |
|
|
|
elog(ERROR, "PL handler function %s() does not return type \"opaque\"", |
|
|
|
elog(ERROR, "function %s() does not return type \"opaque\"", |
|
|
|
NameListToString(stmt->plhandler)); |
|
|
|
NameListToString(stmt->plhandler)); |
|
|
|
|
|
|
|
|
|
|
|
/* validate the validator function */ |
|
|
|
/* validate the validator function */ |
|
|
@ -89,7 +89,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) |
|
|
|
typev[0] = OIDOID; |
|
|
|
typev[0] = OIDOID; |
|
|
|
valProcOid = LookupFuncName(stmt->plvalidator, 1, typev); |
|
|
|
valProcOid = LookupFuncName(stmt->plvalidator, 1, typev); |
|
|
|
if (!OidIsValid(valProcOid)) |
|
|
|
if (!OidIsValid(valProcOid)) |
|
|
|
elog(ERROR, "PL validator function %s(oid) doesn't exist", |
|
|
|
elog(ERROR, "function %s(oid) doesn't exist", |
|
|
|
NameListToString(stmt->plvalidator)); |
|
|
|
NameListToString(stmt->plvalidator)); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -162,7 +162,7 @@ DropProceduralLanguage(DropPLangStmt *stmt) |
|
|
|
* Check permission |
|
|
|
* Check permission |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if (!superuser()) |
|
|
|
if (!superuser()) |
|
|
|
elog(ERROR, "Only users with Postgres superuser privilege are " |
|
|
|
elog(ERROR, "Only users with superuser privilege are " |
|
|
|
"permitted to drop procedural languages"); |
|
|
|
"permitted to drop procedural languages"); |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -177,10 +177,6 @@ DropProceduralLanguage(DropPLangStmt *stmt) |
|
|
|
if (!HeapTupleIsValid(langTup)) |
|
|
|
if (!HeapTupleIsValid(langTup)) |
|
|
|
elog(ERROR, "Language %s doesn't exist", languageName); |
|
|
|
elog(ERROR, "Language %s doesn't exist", languageName); |
|
|
|
|
|
|
|
|
|
|
|
if (!((Form_pg_language) GETSTRUCT(langTup))->lanispl) |
|
|
|
|
|
|
|
elog(ERROR, "Language %s isn't a created procedural language", |
|
|
|
|
|
|
|
languageName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object.classId = get_system_catalog_relid(LanguageRelationName); |
|
|
|
object.classId = get_system_catalog_relid(LanguageRelationName); |
|
|
|
object.objectId = HeapTupleGetOid(langTup); |
|
|
|
object.objectId = HeapTupleGetOid(langTup); |
|
|
|
object.objectSubId = 0; |
|
|
|
object.objectSubId = 0; |
|
|
|