]> granicus.if.org Git - postgresql/commitdiff
Add a hook in ExecCheckRTPerms().
authorRobert Haas <rhaas@postgresql.org>
Fri, 9 Jul 2010 14:06:01 +0000 (14:06 +0000)
committerRobert Haas <rhaas@postgresql.org>
Fri, 9 Jul 2010 14:06:01 +0000 (14:06 +0000)
This hook allows a loadable module to gain control when table permissions
are checked.  It is expected to be used by an eventual SE-PostgreSQL
implementation, but there are other possible applications as well.  A
sample contrib module can be found in the archives at:

http://archives.postgresql.org/pgsql-hackers/2010-05/msg01095.php

Robert Haas and Stephen Frost

src/backend/executor/execMain.c
src/include/executor/executor.h

index 0b6cbcc4af0484f8d07f0263c01444af577efe59..473fbcdae1c1f12ed4a43901ac503c7030c54b23 100644 (file)
@@ -26,7 +26,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.349 2010/04/28 16:10:42 heikki Exp $
+ *       $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.350 2010/07/09 14:06:01 rhaas Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,6 +63,9 @@ ExecutorStart_hook_type ExecutorStart_hook = NULL;
 ExecutorRun_hook_type ExecutorRun_hook = NULL;
 ExecutorEnd_hook_type ExecutorEnd_hook = NULL;
 
+/* Hook for plugin to get control in ExecCheckRTPerms() */
+ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook = NULL;
+
 /* decls for local routines only used within this module */
 static void InitPlan(QueryDesc *queryDesc, int eflags);
 static void ExecEndPlan(PlanState *planstate, EState *estate);
@@ -416,6 +419,9 @@ ExecCheckRTPerms(List *rangeTable)
        {
                ExecCheckRTEPerms((RangeTblEntry *) lfirst(l));
        }
+
+       if (ExecutorCheckPerms_hook)
+               (*ExecutorCheckPerms_hook)(rangeTable);
 }
 
 /*
index b2424a0d087002440274d24fb28d930b301e29a3..119cc2505b2edeb6bb02b2e10e9212628648ae49 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.168 2010/02/26 02:01:24 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.169 2010/07/09 14:06:01 rhaas Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -74,6 +74,10 @@ extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook;
 typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc);
 extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook;
 
+/* Hook for plugins to get control in ExecCheckRTPerms() */
+typedef void (*ExecutorCheckPerms_hook_type) (List *);
+extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook;
+
 
 /*
  * prototypes from functions in execAmi.c