There is no way to show schema permissions in psql.

The alternatives are:

  1) A new \dpn command

  2) Extend \dp to also show rights for schemas, but then we need
     an extra column to describe what kind of object it is, and it
     would mess up the pattern stuff.

  3) Do nothing and let people who want to see schema permissions
     query the system table (select * from pg_namespace).

  4) Since \dn only shows the name and the owner we can simply
     add a permission column.

  5) Some better way that is unknow to me

I've attached a patch for number 4) which I think is the best. Well, 5) is 
better, but also harder to implement.

-- 
/Dennis Björklund
Index: describe.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/describe.c,v
retrieving revision 1.99
diff -u -c -r1.99 describe.c
*** describe.c  18 Jun 2004 06:14:04 -0000      1.99
--- describe.c  30 Jun 2004 13:06:31 -0000
***************
*** 1659,1671 ****
        initPQExpBuffer(&buf);
        printfPQExpBuffer(&buf,
                "SELECT n.nspname AS \"%s\",\n"
!               "       u.usename AS \"%s\"\n"
                "FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n"
                "       ON n.nspowner=u.usesysid\n"
                "WHERE  (n.nspname NOT LIKE 'pg\\\\_temp\\\\_%%' OR\n"
                "                n.nspname = 
(pg_catalog.current_schemas(true))[1])\n", /* temp schema is first */
                                          _("Name"),
!                                         _("Owner"));
        processNamePattern(&buf, pattern, true, false,
                                           NULL, "n.nspname", NULL,
                                           NULL);
--- 1659,1674 ----
        initPQExpBuffer(&buf);
        printfPQExpBuffer(&buf,
                "SELECT n.nspname AS \"%s\",\n"
!               "       u.usename AS \"%s\",\n"
!               "       n.nspacl as \"%s\"\n"
                "FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n"
                "       ON n.nspowner=u.usesysid\n"
                "WHERE  (n.nspname NOT LIKE 'pg\\\\_temp\\\\_%%' OR\n"
                "                n.nspname = 
(pg_catalog.current_schemas(true))[1])\n", /* temp schema is first */
                                          _("Name"),
!                                         _("Owner"),
!                                         _("Access privileges"));
! 
        processNamePattern(&buf, pattern, true, false,
                                           NULL, "n.nspname", NULL,
                                           NULL);
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to