Clean up some loose ends from the column privileges patch: add
Tom Lane <tgl@sss.pgh.pa.us>
Clean up some loose ends from the column privileges patch: add has_column_privilege and has_any_column_privilege SQL functions; fix the information_schema views that are supposed to pay attention to column privileges; adjust pg_stats to show stats for any column you have select privilege on; and fix COPY to allow copying a subset of columns if the user has suitable per-column privileges for all the columns. To improve efficiency of some of the information_schema views, extend the has_xxx_privilege functions to allow inquiring about the OR of a set of privileges in just one call. This is just exposing capability that already existed in the underlying aclcheck routines. In passing, make the information_schema views report the owner's own privileges as being grantable, since Postgres assumes this even when the grant option bit is not set in the ACL. This is a longstanding oversight. Also, make the new has_xxx_privilege functions for foreign data objects follow the same coding conventions used by the older ones. Stephen Frost and Tom Lane
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +102 −33 |
| doc/src/sgml/information_schema.sgml | modified | +12 −17 |
| src/backend/catalog/aclchk.c | modified | +59 −40 |
| src/backend/catalog/information_schema.sql | modified | +113 −99 |
| src/backend/catalog/system_views.sql | modified | +2 −2 |
| src/backend/commands/copy.c | modified | +28 −11 |
| src/backend/utils/adt/acl.c | modified | +1028 −348 |
| src/include/catalog/catversion.h | modified | +2 −2 |
| src/include/catalog/pg_proc.h | modified | +38 −1 |
| src/include/utils/builtins.h | modified | +19 −1 |
| src/test/regress/expected/foreign_data.out | modified | +4 −4 |
| src/test/regress/expected/privileges.out | modified | +10 −0 |
| src/test/regress/expected/rules.out | modified | +3 −3 |
| src/test/regress/sql/privileges.sql | modified | +8 −0 |