From: Robert Haas Date: Fri, 13 May 2011 19:47:31 +0000 (-0400) Subject: More cleanup of FOREIGN TABLE permissions handling. X-Git-Tag: REL9_1_BETA2~126 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=9bb6d9795253bb521f81c626fea49a704a369ca9;p=postgresql.git More cleanup of FOREIGN TABLE permissions handling. 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. --- diff --git a/doc/src/sgml/ref/grant.sgml b/doc/src/sgml/ref/grant.sgml index 93e83320cc6..689aba5104f 100644 --- a/doc/src/sgml/ref/grant.sgml +++ b/doc/src/sgml/ref/grant.sgml @@ -101,7 +101,7 @@ GRANT role_name [, ...] TO ALL - TABLES is considered to include views). + TABLES is considered to include views and foreign tables). diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql index c623fb7e75c..452a0ead44c 100644 --- a/src/backend/catalog/information_schema.sql +++ b/src/backend/catalog/information_schema.sql @@ -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' diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 30366d27530..e474a6980d0 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -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, diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 3ef2fa421db..9a7eca07661 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -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); } diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 2df489f32ea..49d1e7db6f2 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201104251 +#define CATALOG_VERSION_NO 201105131 #endif