]> granicus.if.org Git - postgresql/blobdiff - src/backend/catalog/pg_conversion.c
Refactor the handling of the various DropStmt variants so that when multiple
[postgresql] / src / backend / catalog / pg_conversion.c
index e9c75ebdb604f2f091c93abd74efba99f0c5cf18..753acb133df114b50b8e9b933c060eee487f2e84 100644 (file)
@@ -3,30 +3,32 @@
  * pg_conversion.c
  *       routines to support manipulation of the pg_conversion relation
  *
- * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.38 2007/09/24 01:29:28 adunstan Exp $
+ *       $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.44 2008/06/14 18:04:33 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
 
 #include "access/heapam.h"
+#include "access/sysattr.h"
 #include "catalog/dependency.h"
 #include "catalog/indexing.h"
-#include "catalog/namespace.h"
 #include "catalog/pg_conversion.h"
+#include "catalog/pg_conversion_fn.h"
 #include "catalog/pg_namespace.h"
 #include "catalog/pg_proc.h"
 #include "mb/pg_wchar.h"
+#include "miscadmin.h"
+#include "utils/acl.h"
 #include "utils/builtins.h"
 #include "utils/fmgroids.h"
 #include "utils/syscache.h"
-#include "utils/acl.h"
-#include "miscadmin.h"
+#include "utils/tqual.h"
 
 /*
  * ConversionCreate
@@ -135,40 +137,6 @@ ConversionCreate(const char *conname, Oid connamespace,
        return oid;
 }
 
-/*
- * ConversionDrop
- *
- * Drop a conversion after doing permission checks.
- */
-void
-ConversionDrop(Oid conversionOid, DropBehavior behavior)
-{
-       HeapTuple       tuple;
-       ObjectAddress object;
-
-       tuple = SearchSysCache(CONVOID,
-                                                  ObjectIdGetDatum(conversionOid),
-                                                  0, 0, 0);
-       if (!HeapTupleIsValid(tuple))
-               elog(ERROR, "cache lookup failed for conversion %u", conversionOid);
-
-       if (!superuser() &&
-               ((Form_pg_conversion) GETSTRUCT(tuple))->conowner != GetUserId())
-               aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CONVERSION,
-                                 NameStr(((Form_pg_conversion) GETSTRUCT(tuple))->conname));
-
-       ReleaseSysCache(tuple);
-
-       /*
-        * Do the deletion
-        */
-       object.classId = ConversionRelationId;
-       object.objectId = conversionOid;
-       object.objectSubId = 0;
-
-       performDeletion(&object, behavior);
-}
-
 /*
  * RemoveConversionById
  *
@@ -275,4 +243,3 @@ FindConversion(const char *conname, Oid connamespace)
 
        return conoid;
 }
-