Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xDMRJ-00000000SxV-2zug for pgsql-bugs@arkaria.postgresql.org; Sun, 04 Oct 2026 13:39:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xDMRG-00000004sWj-3cCZ for pgsql-bugs@arkaria.postgresql.org; Sun, 04 Oct 2026 13:39:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xDMRG-00000004sWa-2NJC for pgsql-bugs@lists.postgresql.org; Sun, 04 Oct 2026 13:39:38 +0000 Received: from mail-ed2-x29.google.com ([2a00:1450:4864:33::29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xDMRE-00000000JZL-0rEU for pgsql-bugs@lists.postgresql.org; Sun, 04 Oct 2026 13:39:36 +0000 Received: by mail-ed2-x29.google.com with SMTP id 4fb4d7f45d1cf-6aa0ee64afdso1118963a12.0 for ; Sun, 04 Oct 2026 06:39:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1791121174; x=1791725974; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:to:from:subject:message-id:from:to:cc :subject:date:message-id:reply-to:content-type; bh=tNZPFggZWwOnuEhAN24rHBxFk4SVR8ZgIwnYvpYs9wU=; b=U1cVuGU3ebDlC7a4g5kVs654oRUj9pXpgqOl6tTq/VzCzz+EwsHQk0E9UqHITF6s9B 8IZHc2Ql0tpeSypZk38XYW3giymWTBrVquYoVY1HTWhqa93gq/D4V6flehPQ/QW18zSI 3xq7npmlgpDXDOX53OEA9uO6pi4myZZnC7d9ZQFMXyNy/DWaQtG5yYfzYQ6wNbAp8vEX JbK4XvMGyZcZU7AH+fk345otK+H6Aw44S7101fSECwbPy1rTeO44xUnYjIjsUediDa5o rQ1ZxDwfsdGwXQMahvHymBMXBzOQVnkcyPjUvuHS7xHgGVHSg9nkIth7DB3CxqxGj62H I5ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791121174; x=1791725974; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tNZPFggZWwOnuEhAN24rHBxFk4SVR8ZgIwnYvpYs9wU=; b=YM6AJ4+ptTY40eb3/JbPb50DFQkmlC5TIey75bA6NBlNjsedZSr4mpDFHIQNoBoEee BjqJZZUeSfhOjVZaAkJmhzyA60C2ySqRtt1kM/0Exf6QjQZ3VWJD/l3vdu0OLSxL6pzr Zc/txFb32cXNJnPXm7eIuu5rldv2zslHVuelJTXC3wbDHmVEnig+hiv/AzPWbp3nt/Ed G75cp3EsJZnmC56z6DTUK1lm2GqgMHtB5etHsqWsXRwDNFiQvq2LzGT8ii+TcPKQYEo0 vT1TWze83NGE6Bijp1uFyanjfnsl0b0za/rfF02SeqLWPP4aWhDAFxpg1Tp65eNwZP6Z aIlg== X-Forwarded-Encrypted: i=1; AKwUvByvH9QbeBi2D0HdSEYsl1S18UlUEr3RP8Eebo4ImVKwltdkgmExRWBMjkK4qm3eeh5hIb/BOXJzg3S5@lists.postgresql.org X-Gm-Message-State: AFuF++liZ0C6nXuNgH9Ikz7z0D3tUSmoTi16B1XGt+2VuFWC4/Pk64D7 /b3ZqZ8Bbn3sKRYQ4fEnwzPs+AWENUjwf5I5nCwtGuaZju/TW7DWyNOxehEegXg6ZrpcOp4KA5G wPn0Z X-Gm-Gg: AYBFou1E42hNQgYNbMkBeRQWtj8HYvinG8tKjWwmd3Y/+8+VKWP+5kH3oCh8ZPkkTwc AdHPVYvV9cZhzU0GwDEhQ5DQ6ZF23XN7MeSKpo4PNHkq6+JP+/PJ+OKYMoPYZROvnnLnj3EJUOR c3UywbF+7MdunoB8eMCovk8laBdYE1oKl7wCdsZXVtoDgljLS1RI2+MS38XWcgMhEj22GY9AJ9u NE+TPlGD6X0V+MUMCTyq6Tqko2TilMqG+yJCOWyDXJd1YozkkeZstp6s4MbrYhTlf9I4YRG+ZQa Ij8jlSNi2F5PBprJKcv2k/Lfe7si06RFLrIaP718919uyBn22zU7oKmzG4tNbhr131jwZiKQAy8 yhpEQlTddAT8iIW7AOx9VjgVEpA0HVVLlFDJ8miKPq3bEnR2LR1QqqDLCEAyDY94fdNwrWoFM/z TLJw+mLFv2ePWUzckqFZVYPjvaJsYg+b/ylSFONfsdFDSW2mFFR4gxhhO/ime79s4VgmlQP2M1t JM+28r+ArTGzUmvwQUOw6/5Y7JLYw== X-Received: by 2002:a17:907:d16:b0:c2a:f7f2:b732 with SMTP id a640c23a62f3a-c2e4b2cc197mr699539466b.45.1791121173240; Sun, 04 Oct 2026 06:39:33 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:260:47ea:db74:62c5:e26e:a4a6]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2e4cf85881sm307991866b.56.2026.10.04.06.39.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Oct 2026 06:39:32 -0700 (PDT) Message-ID: Subject: Re: BUG #19740: `has_language_privilege` returns TRUE for a nonexistent language OID when the user is a superuser From: Laurenz Albe To: theshallow27@gmail.com, pgsql-bugs@lists.postgresql.org Date: Sun, 04 Oct 2026 15:39:32 +0200 In-Reply-To: <19740-677922f8a0cc921c@postgresql.org> References: <19740-677922f8a0cc921c@postgresql.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-2.fc44) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2026-10-02 at 22:38 +0000, PG Bug reporting form wrote: > ostgreSQL version: 18.6 >=20 > For a nonexistent language OID, the implicit-current-user form returns TR= UE > when the current user is a superuser. An explicit non-superuser role retu= rns > 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. >=20 > **Reproduction:** Run as the default `postgres` superuser: >=20 > ```sql > SELECT NOT EXISTS (SELECT FROM pg_language WHERE oid =3D 0), > has_language_privilege(0::oid, 'USAGE'), > has_language_privilege('pg_monitor', 0::oid, 'USAGE'); > ``` >=20 > **Actual result:** `true | true | NULL`. >=20 > **Expected result:** The privilege inquiry should return NULL for the > missing > language OID in both forms, matching the function's missing-object handli= ng > for non-superuser roles. I agree that that is not so great. Since this behavior is in the function object_aclcheck_ext(), which is used by all the has_*_privilege functions, the same oddity affects all those functions. I think that would be easy to change, but I wonder if it is a good idea. That bug hardly hurts: has_language_privilege() is typically not what you use to find out if a procedural language exists or not. And perhaps there is a misguided script somewhere out there that would suddenly start to misbehave if a superuser no longer is reported as having all privileges on non-existing objects. Is it a real problem for you? Yours, Laurenz Albe