DROP OWNED BY is broken on master branch.

From: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: DROP OWNED BY is broken on master branch.
Date: 2022-09-26 07:43:53
Message-ID: CAGPqQf2vO+nbo=3yAdZ8v26Rbug7bY4YjPaPLZx=L1NZ9-CC3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,

Consider the below test:

postgres(at)53130=#create role test WITH login createdb;
CREATE ROLE
postgres(at)53130=#\c - test
You are now connected to database "postgres" as user "test".
postgres(at)53150=#create database test;
CREATE DATABASE
postgres(at)53150=#\c - rushabh
You are now connected to database "postgres" as user "rushabh".
postgres(at)53162=#
postgres(at)53162=#
-- This was working before the below mentioned commit.
postgres(at)53162=#drop owned by test;
ERROR: global objects cannot be deleted by doDeletion

Commit 6566133c5f52771198aca07ed18f84519fac1be7 ensure that
pg_auth_members.grantor is always valid. This commit did changes
into shdepDropOwned() function and combined the SHARED_DEPENDENCY_ACL
and SHARED_DEPENDENCY_OWNER. In that process it removed condition for
local object in owner dependency.

case SHARED_DEPENDENCY_OWNER:
- /* If a local object, save it for deletion below */
- if (sdepForm->dbid == MyDatabaseId)
+ /* Save it for deletion below */

Case ending up with above error because of the above removed condition.

Please find the attached patch which fixes the case.

Thanks,
Rushabh Lathia
www.EnterpriseDB.com

Attachment Content-Type Size
fix_shdepDropOwned.patch text/x-patch 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-09-26 07:50:36 Re: [small patch] Change datatype of ParallelMessagePending from "volatile bool" to "volatile sig_atomic_t"
Previous Message Alvaro Herrera 2022-09-26 07:39:49 Re: A doubt about a newly added errdetail