BUG #19740: `has_language_privilege` returns TRUE for a nonexistent language OID when the user is a superuser - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #19740: `has_language_privilege` returns TRUE for a nonexistent language OID when the user is a superuser
Date
Msg-id 19740-677922f8a0cc921c@postgresql.org
Whole thread
Responses Re: BUG #19740: `has_language_privilege` returns TRUE for a nonexistent language OID when the user is a superuser
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      19740
Logged by:          Shallow
Email address:      theshallow27@gmail.com
PostgreSQL version: 18.6
Operating system:   Linux
Description:

For a nonexistent language OID, the implicit-current-user form returns TRUE
when the current user is a superuser. An explicit non-superuser role returns
NULL for the same missing OID. This makes the result depend on the role's
superuser status even though the referenced language does not exist.

**Reproduction:** Run as the default `postgres` superuser:

```sql
SELECT NOT EXISTS (SELECT FROM pg_language WHERE oid = 0),
       has_language_privilege(0::oid, 'USAGE'),
       has_language_privilege('pg_monitor', 0::oid, 'USAGE');
```

**Actual result:** `true | true | NULL`.

**Expected result:** The privilege inquiry should return NULL for the
missing
language OID in both forms, matching the function's missing-object handling
for non-superuser roles.





pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #19739: Parameterized first autocommit statement can have different `transaction_timestamp()` and `statement
Next
From: PG Bug reporting form
Date:
Subject: BUG #19741: `avg(double precision)` overflows on cancelling finite inputs whose mean is representable