Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4NDR-0006QI-C0 for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Dec 2022 14:22:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p4NDQ-0003kP-7n for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Dec 2022 14:22:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4NDP-0003kE-RC for pgsql-hackers@lists.postgresql.org; Sun, 11 Dec 2022 14:22:03 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p4NDM-0001lA-QL for pgsql-hackers@lists.postgresql.org; Sun, 11 Dec 2022 14:22:02 +0000 Received: by mail-io1-xd34.google.com with SMTP id i83so4485913ioa.11 for ; Sun, 11 Dec 2022 06:22:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=sWYJW3fn3R2Vccl9q4pTDLxU0baJTywbEP2a6TSLD/0=; b=TT6Q6UAnlqBYMdjP1dV83sgJ4LxyNx0T8HDrAfEwVf7/BaRim+0JNRsed2jeErz54p xllXkJ1FCG/xghpviNnuSRslz1I2ObxOm35dHcN5KH6LEWkleLhyYHS7mOotozT1/9T4 v/eql3Me9sR+6RVfUarrYTGOhDkUJEhTMp6+fgVQQ3uzkHQAZVCq+A7U4f9WW/ErF8tc uakl8Q7BPqiGYfUTd/KceecY+nHC2ZvNqqUsR5XaNfDjrTXvYKTvK2nb324z4whKzoUO +o7T1pCl1do1Bf2a0qjPXUwZgDNZYxGudIECxU07l/uMhJP+PnhzzDiLXr5tWAK82uI8 +PvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sWYJW3fn3R2Vccl9q4pTDLxU0baJTywbEP2a6TSLD/0=; b=5TgxZmqWtFDySDCJPrSFL5REhbcjqaYJ701QHey1/uzVAGBw8yYdUUUrMaGqdruKnQ P+VXp3vvWlGIxnp9zHDkMEVtTCEEV6pzqhdUEP9CjZgN+oM1fg0eH6DBPW2zXsQZqJ9u HWH4EAwbd4qcLNsZiSOL554lO7ODbSwwcgH1V06zB1JirKPgyUJftA37O+q+ySv/9oSn oUN3bqvNP5hvGF1TVgB5qphsBWLiUip6dHnEgqiKLsKXgs0sDdgI6UFQJBIyPpFxg7ot I+So1KRQ2M/elebiSY1op6SQLGj+MSjG4B+hs27QvOv8GuB7ERv7SOud32RDNDERkR4i AjUQ== X-Gm-Message-State: ANoB5pkSqqC2LRd3igzdCVafo1YjECFSovo5wrMiH1CA/KKQEabFWlqb io3kuh0vcX3v2Lkqsk4/Xwe8pQ== X-Google-Smtp-Source: AA0mqf6ikJN06ZuTBa3+sTnsD0UA2F+D5zWKRkCXwsANIGijn0HneYJbYV1wlzgNuHZCV8GAN1VfZQ== X-Received: by 2002:a5e:a90d:0:b0:6e2:d500:ffd9 with SMTP id c13-20020a5ea90d000000b006e2d500ffd9mr7296196iod.12.1670768519820; Sun, 11 Dec 2022 06:21:59 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id h3-20020a056638062300b003728cd8bc7csm2286222jar.38.2022.12.11.06.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Dec 2022 06:21:59 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 92923800665; Sun, 11 Dec 2022 08:21:58 -0600 (CST) Date: Sun, 11 Dec 2022 08:21:58 -0600 From: Justin Pryzby To: Amit Langote Cc: Alvaro Herrera , Ian Lawrence Barwick , Tom Lane , David Rowley , Greg Stark , Julien Rouhaud , pgsql-hackers@lists.postgresql.org Subject: Re: ExecRTCheckPerms() and many prunable partitions (checkAsUser) Message-ID: <20221211142158.GC27893@telsasoft.com> References: <20221129092708.uooopfzpiwrhgedl@alvherre.pgsql> <20221210201753.GA27893@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Dec 11, 2022 at 06:25:48PM +0900, Amit Langote wrote: > On Sun, Dec 11, 2022 at 5:17 AM Justin Pryzby wrote: > > The original code rechecks rte->checkAsUser with the rte of the parent > > rel. The patch changed to access onerel instead, but that's not updated > > after looping to find the parent. > > > > Is that okay ? It doesn't seem intentional, since "userid" is still > > being recomputed, but based on onerel, which hasn't changed. The > > original intent (since 553d2ec27) is to recheck the parent's > > "checkAsUser". > > > > It seems like this would matter for partitioned tables, when the > > partition isn't readable, but its parent is, and accessed via a view > > owned by another user? > > Thanks for pointing this out. > > I think these blocks which are rewriting userid to basically the same > value should have been removed from these sites as part of 599b33b94. I thought maybe; thanks for checking. Little nitpicks: 001: Fine to use the same userid as it's same in all => the same 002: give that it's a subquery rel. => given -- Justin