Skip to content

Commit fd5b397

Browse files
committed
Implement the information schema with_hierarchy column
In PostgreSQL, this is included in the SELECT privilege, so show YES or NO depending on whether SELECT is granted.
1 parent 3104cc8 commit fd5b397

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

doc/src/sgml/information_schema.sgml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,7 +3684,14 @@ ORDER BY c.ordinal_position;
36843684
<row>
36853685
<entry><literal>with_hierarchy</literal></entry>
36863686
<entry><type>yes_or_no</type></entry>
3687-
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
3687+
<entry>
3688+
In the SQL standard, <literal>WITH HIERARCHY OPTION</literal>
3689+
is a separate (sub-)privilege allowing certain operations on
3690+
table inheritance hierarchies. In PostgreSQL, this is included
3691+
in the <literal>SELECT</literal> privilege, so this column
3692+
shows <literal>YES</literal> if the privilege
3693+
is <literal>SELECT</literal>, else <literal>NO</literal>.
3694+
</entry>
36883695
</row>
36893696
</tbody>
36903697
</tgroup>
@@ -5364,7 +5371,14 @@ ORDER BY c.ordinal_position;
53645371
<row>
53655372
<entry><literal>with_hierarchy</literal></entry>
53665373
<entry><type>yes_or_no</type></entry>
5367-
<entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
5374+
<entry>
5375+
In the SQL standard, <literal>WITH HIERARCHY OPTION</literal>
5376+
is a separate (sub-)privilege allowing certain operations on
5377+
table inheritance hierarchies. In PostgreSQL, this is included
5378+
in the <literal>SELECT</literal> privilege, so this column
5379+
shows <literal>YES</literal> if the privilege
5380+
is <literal>SELECT</literal>, else <literal>NO</literal>.
5381+
</entry>
53685382
</row>
53695383
</tbody>
53705384
</tgroup>

src/backend/catalog/information_schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ CREATE VIEW table_privileges AS
17851785
pg_has_role(grantee.oid, c.relowner, 'USAGE')
17861786
OR c.grantable
17871787
THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable,
1788-
CAST('NO' AS yes_or_no) AS with_hierarchy
1788+
CAST(CASE WHEN c.prtype = 'SELECT' THEN 'YES' ELSE 'NO' END AS yes_or_no) AS with_hierarchy
17891789

17901790
FROM (
17911791
SELECT oid, relname, relnamespace, relkind, relowner, (aclexplode(relacl)).* FROM pg_class

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy