mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 00:03:57 -04:00 
			
		
		
		
	Add collations to information_schema.usage_privileges
This is faked information like for domains.
This commit is contained in:
		
							parent
							
								
									43bdf3583a
								
							
						
					
					
						commit
						091bda0188
					
				| @ -3560,7 +3560,7 @@ ORDER BY c.ordinal_position; | |||||||
|      <row> |      <row> | ||||||
|       <entry><literal>object_type</literal></entry> |       <entry><literal>object_type</literal></entry> | ||||||
|       <entry><type>character_data</type></entry> |       <entry><type>character_data</type></entry> | ||||||
|       <entry><literal>DOMAIN</literal> or <literal>FOREIGN DATA WRAPPER</literal> or <literal>FOREIGN SERVER</literal></entry> |       <entry><literal>COLLATION</literal> or <literal>DOMAIN</literal> or <literal>FOREIGN DATA WRAPPER</literal> or <literal>FOREIGN SERVER</literal></entry> | ||||||
|      </row> |      </row> | ||||||
| 
 | 
 | ||||||
|      <row> |      <row> | ||||||
| @ -5497,15 +5497,15 @@ ORDER BY c.ordinal_position; | |||||||
|    <literal>USAGE</literal> privileges granted on various kinds of |    <literal>USAGE</literal> privileges granted on various kinds of | ||||||
|    objects to a currently enabled role or by a currently enabled role. |    objects to a currently enabled role or by a currently enabled role. | ||||||
|    In <productname>PostgreSQL</productname>, this currently applies to |    In <productname>PostgreSQL</productname>, this currently applies to | ||||||
|    domains, foreign-data wrappers, and foreign servers.  There is one |    collations, domains, foreign-data wrappers, and foreign servers.  There is one | ||||||
|    row for each combination of object, grantor, and grantee. |    row for each combination of object, grantor, and grantee. | ||||||
|   </para> |   </para> | ||||||
| 
 | 
 | ||||||
|   <para> |   <para> | ||||||
|    Since domains do not have real privileges |    Since collations and domains do not have real privileges | ||||||
|    in <productname>PostgreSQL</productname>, this view shows implicit |    in <productname>PostgreSQL</productname>, this view shows implicit | ||||||
|    non-grantable <literal>USAGE</literal> privileges granted by the |    non-grantable <literal>USAGE</literal> privileges granted by the | ||||||
|    owner to <literal>PUBLIC</literal> for all domains.  The other |    owner to <literal>PUBLIC</literal> for all collations and domains.  The other | ||||||
|    object types, however, show real privileges. |    object types, however, show real privileges. | ||||||
|   </para> |   </para> | ||||||
| 
 | 
 | ||||||
| @ -5556,7 +5556,7 @@ ORDER BY c.ordinal_position; | |||||||
|      <row> |      <row> | ||||||
|       <entry><literal>object_type</literal></entry> |       <entry><literal>object_type</literal></entry> | ||||||
|       <entry><type>character_data</type></entry> |       <entry><type>character_data</type></entry> | ||||||
|       <entry><literal>DOMAIN</literal> or <literal>FOREIGN DATA WRAPPER</literal> or <literal>FOREIGN SERVER</literal></entry> |       <entry><literal>COLLATION</literal> or <literal>DOMAIN</literal> or <literal>FOREIGN DATA WRAPPER</literal> or <literal>FOREIGN SERVER</literal></entry> | ||||||
|      </row> |      </row> | ||||||
| 
 | 
 | ||||||
|      <row> |      <row> | ||||||
|  | |||||||
| @ -2019,6 +2019,27 @@ GRANT SELECT ON triggers TO PUBLIC; | |||||||
| 
 | 
 | ||||||
| CREATE VIEW usage_privileges AS | CREATE VIEW usage_privileges AS | ||||||
| 
 | 
 | ||||||
|  |     /* collations */ | ||||||
|  |     -- Collations have no real privileges, so we represent all collations with implicit usage privilege here. | ||||||
|  |     SELECT CAST(u.rolname AS sql_identifier) AS grantor, | ||||||
|  |            CAST('PUBLIC' AS sql_identifier) AS grantee, | ||||||
|  |            CAST(current_database() AS sql_identifier) AS object_catalog, | ||||||
|  |            CAST(n.nspname AS sql_identifier) AS object_schema, | ||||||
|  |            CAST(c.collname AS sql_identifier) AS object_name, | ||||||
|  |            CAST('COLLATION' AS character_data) AS object_type, | ||||||
|  |            CAST('USAGE' AS character_data) AS privilege_type, | ||||||
|  |            CAST('NO' AS yes_or_no) AS is_grantable | ||||||
|  | 
 | ||||||
|  |     FROM pg_authid u, | ||||||
|  |          pg_namespace n, | ||||||
|  |          pg_collation c | ||||||
|  | 
 | ||||||
|  |     WHERE u.oid = c.collowner | ||||||
|  |           AND c.collnamespace = n.oid | ||||||
|  |           AND c.collencoding = (SELECT encoding FROM pg_catalog.pg_database WHERE datname = pg_catalog.current_database()) | ||||||
|  | 
 | ||||||
|  |     UNION ALL | ||||||
|  | 
 | ||||||
|     /* domains */ |     /* domains */ | ||||||
|     -- Domains have no real privileges, so we represent all domains with implicit usage privilege here. |     -- Domains have no real privileges, so we represent all domains with implicit usage privilege here. | ||||||
|     SELECT CAST(u.rolname AS sql_identifier) AS grantor, |     SELECT CAST(u.rolname AS sql_identifier) AS grantor, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user