BUG #19703: information_schema.usage_privileges omits a sequence owner's implicit USAGE privilege - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #19703: information_schema.usage_privileges omits a sequence owner's implicit USAGE privilege
Date
Msg-id 19703-49d6f1796001a6d7@postgresql.org
Whole thread
Responses Re: BUG #19703: information_schema.usage_privileges omits a sequence owner's implicit USAGE privilege
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      19703
Logged by:          Qifan Liu
Email address:      imchifan@163.com
PostgreSQL version: 18.6
Operating system:   Linux/amd64
Description:

For a newly created sequence, has_sequence_privilege reports that the owner
has USAGE, but information_schema.usage_privileges omits that privilege. The
view reports the owner privilege only after the same USAGE privilege is
redundantly granted explicitly.

Steps to reproduce
------------------
\pset tuples_only on
\pset format unaligned
DROP SEQUENCE IF EXISTS bugseer_postgres_00004_seq_acl;
CREATE SEQUENCE bugseer_postgres_00004_seq_acl;

SELECT 'implicit_privilege=' || has_sequence_privilege(
  current_user, 'bugseer_postgres_00004_seq_acl', 'USAGE');
SELECT 'implicit_view_rows=' || count(*)
FROM information_schema.usage_privileges
WHERE object_schema = current_schema
  AND object_name = 'bugseer_postgres_00004_seq_acl'
  AND object_type = 'SEQUENCE'
  AND grantee = current_user
  AND privilege_type = 'USAGE';

GRANT USAGE ON SEQUENCE bugseer_postgres_00004_seq_acl TO CURRENT_USER;
SELECT 'explicit_view_rows=' || count(*)
FROM information_schema.usage_privileges
WHERE object_schema = current_schema
  AND object_name = 'bugseer_postgres_00004_seq_acl'
  AND object_type = 'SEQUENCE'
  AND grantee = current_user
  AND privilege_type = 'USAGE';

Actual result
-------------
implicit_privilege=true
implicit_view_rows=0
GRANT
explicit_view_rows=1

Expected result
---------------
information_schema.usage_privileges should report one owner USAGE row before
the redundant explicit grant, and the row count should remain one afterward.

Additional information
----------------------
The issue was reproduced on PostgreSQL 20devel, PostgreSQL 18.6, and
PostgreSQL 17.11.





pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #19702: decode() accepts Base64 payload after terminal padding
Next
From: PG Bug reporting form
Date:
Subject: BUG #19704: ispell dictionary accepts trailing junk in numeric COMPOUNDFLAG