More cleanup of FOREIGN TABLE permissions handling.
authorRobert Haas <rhaas@postgresql.org>
Fri, 13 May 2011 19:47:31 +0000 (15:47 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 13 May 2011 19:51:03 +0000 (15:51 -0400)
This commit fixes psql, pg_dump, and the information schema to be
consistent with the backend changes which I made as part of commit
be90032e0d1cf473bdd99aee94218218f59f29f1, and also includes a
related documentation tweak.

Shigeru Hanada, with slight adjustment.

doc/src/sgml/ref/grant.sgml
src/backend/catalog/information_schema.sql
src/bin/pg_dump/pg_dump.c
src/bin/psql/tab-complete.c
src/include/catalog/catversion.h

index 93e83320cc60fabbcae9ffc67555a56815333923..689aba5104f1eef2e00618b903ec81030ce4fb83 100644 (file)
@@ -101,7 +101,7 @@ GRANT <replaceable class="PARAMETER">role_name</replaceable> [, ...] TO <replace
    There is also an option to grant privileges on all objects of the same
    type within one or more schemas.  This functionality is currently supported
    only for tables, sequences, and functions (but note that <literal>ALL
-   TABLES</> is considered to include views).
+   TABLES</> is considered to include views and foreign tables).
   </para>
 
   <para>
index c623fb7e75cc7ad1788c34f6604bc26bbeafb875..452a0ead44cab53c2dcc1fcc85b252ba00a404f2 100644 (file)
@@ -2557,8 +2557,8 @@ CREATE VIEW _pg_foreign_tables AS
     WHERE w.oid = s.srvfdw
           AND u.oid = c.relowner
           AND (pg_has_role(c.relowner, 'USAGE')
-               OR has_table_privilege(c.oid, 'SELECT')
-               OR has_any_column_privilege(c.oid, 'SELECT'))
+               OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER')
+               OR has_any_column_privilege(c.oid, 'SELECT, INSERT, UPDATE, REFERENCES'))
           AND n.oid = c.relnamespace
           AND c.oid = t.ftrelid
           AND c.relkind = 'f'
index 30366d2753026477682af3ad51ca299d100fcb8e..e474a6980d0c1f2ac1fc027270f15b50f8a1cb05 100644 (file)
@@ -11804,7 +11804,6 @@ dumpTable(Archive *fout, TableInfo *tbinfo)
        namecopy = strdup(fmtId(tbinfo->dobj.name));
        dumpACL(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId,
                (tbinfo->relkind == RELKIND_SEQUENCE) ? "SEQUENCE" :
-               (tbinfo->relkind == RELKIND_FOREIGN_TABLE) ? "FOREIGN TABLE" :
                "TABLE",
                namecopy, NULL, tbinfo->dobj.name,
                tbinfo->dobj.namespace->dobj.name, tbinfo->rolname,
index 3ef2fa421db150eb84484f292b41dee3d4a6059a..9a7eca0766101bf2f61d3d6faaeaa437b2ad5dfe 100644 (file)
@@ -2234,7 +2234,6 @@ psql_completion(char *text, int start, int end)
                                   " UNION SELECT 'DATABASE'"
                                   " UNION SELECT 'FOREIGN DATA WRAPPER'"
                                   " UNION SELECT 'FOREIGN SERVER'"
-                                  " UNION SELECT 'FOREIGN TABLE'"
                                   " UNION SELECT 'FUNCTION'"
                                   " UNION SELECT 'LANGUAGE'"
                                   " UNION SELECT 'LARGE OBJECT'"
@@ -2246,7 +2245,7 @@ psql_completion(char *text, int start, int end)
             pg_strcasecmp(prev_wd, "FOREIGN") == 0)
    {
        static const char *const list_privilege_foreign[] =
-       {"DATA WRAPPER", "SERVER", "TABLE", NULL};
+       {"DATA WRAPPER", "SERVER", NULL};
 
        COMPLETE_WITH_LIST(list_privilege_foreign);
    }
index 2df489f32ea615088247500d56c03c83e6f56587..49d1e7db6f2446388bed10642396160b5db63ce5 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 201104251
+#define CATALOG_VERSION_NO 201105131
 
 #endif