Giter Club home page Giter Club logo

pg_restrict's People

Contributors

eulerto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pg_restrict's Issues

restrict ROLE

Restrict ROLE commands (CREATE, ALTER, and DROP) to a master role. There is a parameter to restrict DROP ROLE, however, this proposal is to avoid any role commands.

restrict EXTENSION

restrict EXTENSION commands (CREATE, ALTER, and DROP) to a master role.

restrict DATABASE

Restrict DATABASE commands (CREATE, ALTER, and DROP) to a master role. There is a parameter to restrict DROP DATABASE, however, this proposal is to avoid any database commands.

postgres 14 support

solve

diff --git a/pg_restrict.c b/pg_restrict.c
index 0898ede..4d23231 100644
--- a/pg_restrict.c
+++ b/pg_restrict.c
@@ -56,7 +56,11 @@ static bool check_master_roles(char **newval, void **extra,
                                                           GucSource source);
 static void assign_master_roles(const char *newval, void *extra);
 
-#if PG_VERSION_NUM >= 130000
+#if PG_VERSION_NUM >= 140000
+static void pgr_ProcessUtility(PlannedStmt *pstmt, const char *queryString, bool readOnlyTree,
+                                                          ProcessUtilityContext context, ParamListInfo params, QueryEnvironment *queryEnv,
+                                                          DestReceiver *dest, QueryCompletion *qc);
+#elif PG_VERSION_NUM >= 130000
 static void pgr_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
                                                           ProcessUtilityContext context, ParamListInfo params, QueryEnvironment *queryEnv,
                                                           DestReceiver *dest, QueryCompletion *qc);
@@ -151,7 +155,14 @@ _PG_fini(void)
 /*
  * ProcessUtility hook
  */
-#if PG_VERSION_NUM >= 130000
+#if PG_VERSION_NUM >= 140000
+static void
+pgr_ProcessUtility(PlannedStmt *pstmt, const char *queryString, bool readOnlyTree,
+                                  ProcessUtilityContext context, ParamListInfo params, QueryEnvironment *queryEnv,
+                                  DestReceiver *dest, QueryCompletion *qc)
+{
+       Node    *pst = (Node *) pstmt->utilityStmt;
+#elif PG_VERSION_NUM >= 130000
 static void
 pgr_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
                                   ProcessUtilityContext context, ParamListInfo params, QueryEnvironment *queryEnv,
@@ -308,7 +319,16 @@ pgr_ProcessUtility(Node *pst, const char *queryString,
         * Fallback to normal process, be it the previous hook loaded
         * or the in-core code path if the previous hook does not exist.
         */
-#if PG_VERSION_NUM >= 130000
+#if PG_VERSION_NUM >= 140000
+       if (prev_ProcessUtility)
+               prev_ProcessUtility(pstmt, queryString, readOnlyTree,
+                                                       context, params, queryEnv,
+                                                       dest, qc);
+       else
+               standard_ProcessUtility(pstmt, queryString, readOnlyTree,
+                                                               context, params, queryEnv,
+                                                               dest, qc);
+#elif PG_VERSION_NUM >= 130000
        if (prev_ProcessUtility)
                prev_ProcessUtility(pstmt, queryString,
                                                        context, params, queryEnv,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.