Thread

Commits

  1. Move privilege check to the right place

  1. missing privilege check after not-null constraint rework

    Alvaro Herrera <alvherre@alvh.no-ip.org> — 2023-09-05T17:44:44Z

    Here's a fix to move the privilege check on constraint dropping from
    ATExecDropConstraint to dropconstraint_internal.  The former doesn't
    recurse anymore, so there's no point in doing that or in fact even
    having the 'recursing' argument anymore.
    
    This fixes the following test case
    
    CREATE ROLE alice;
    CREATE ROLE bob;
    
    GRANT ALL ON SCHEMA PUBLIC to alice, bob;
    GRANT alice TO bob;
    
    SET ROLE alice;
    CREATE TABLE parent (a int NOT NULL);
    
    SET ROLE bob;
    CREATE TABLE child () INHERITS (parent);
    
    At this point, bob owns the child table, to which alice has no access.
    But alice can do this:
    ALTER TABLE parent ALTER a DROP NOT NULL;
    which is undesirable, because it removes the NOT NULL constraint from
    table child, which is owned by bob.
    
    
    Alternatively, we could say that Alice is allowed to drop the constraint
    on her table, and that we should react by marking the constraint on
    Bob's child table as 'islocal' instead of removing it.  Now, I'm pretty
    sure we don't really care one bit about this case, and the reason is
    this: we seem to have no tests for mixed-ownership table hierarchies.
    If we did care, we would have some, and this bug would not have occurred
    in the first place.  Besides, nobody likes legacy inheritance anyway.
    
    -- 
    Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
    "La persona que no quería pecar / estaba obligada a sentarse
     en duras y empinadas sillas    / desprovistas, por cierto
     de blandos atenuantes"                          (Patricio Vogel)
    
    
    
    
  2. Re: missing privilege check after not-null constraint rework

    Alvaro Herrera <alvherre@alvh.no-ip.org> — 2023-09-05T17:45:27Z

    On 2023-Sep-05, Alvaro Herrera wrote:
    
    > Here's a fix to move the privilege check on constraint dropping from
    > ATExecDropConstraint to dropconstraint_internal.
    
    
    -- 
    Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
    "No renuncies a nada. No te aferres a nada."
    
  3. Re: missing privilege check after not-null constraint rework

    Alvaro Herrera <alvherre@alvh.no-ip.org> — 2023-09-07T11:02:45Z

    On 2023-Sep-05, Alvaro Herrera wrote:
    
    > On 2023-Sep-05, Alvaro Herrera wrote:
    > 
    > > Here's a fix to move the privilege check on constraint dropping from
    > > ATExecDropConstraint to dropconstraint_internal.
    
    I have pushed this.  It's just a fixup for an embarrasing bug in
    b0e96f311985.
    
    -- 
    Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
    "Pensar que el espectro que vemos es ilusorio no lo despoja de espanto,
    sólo le suma el nuevo terror de la locura" (Perelandra, C.S. Lewis)