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.94.2) (envelope-from ) id 1tk8tA-000ViY-Ti for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Feb 2025 21:42:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tk8t9-003cTO-10 for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Feb 2025 21:42:51 +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.94.2) (envelope-from ) id 1tk8t8-003cTF-Nh for pgsql-hackers@lists.postgresql.org; Mon, 17 Feb 2025 21:42:50 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tk8t6-001OPP-2L for pgsql-hackers@postgresql.org; Mon, 17 Feb 2025 21:42:49 +0000 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-85595f813caso80849239f.3 for ; Mon, 17 Feb 2025 13:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739828568; x=1740433368; darn=postgresql.org; h=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=kEp0V/uofLEq3T7XRrU9W7v2p/lNOOfnBaZ7yuPWtio=; b=CTGOlrsCfLVRcqF2Nzwp8p7qNHy7cpVVdl5P7T4dghIz6k45z/VpSfDB7om88Ja0qp 55y+4kpRO622cOeiox5SCn/ccFCfG+DfmPurYwcEwvHLkluINEj0Q/oRBY9tPdeQBeZI zNct3i4z4IJcCwBvu/6JIwgkZtQ387WCGVBrL/J81Uxjeogv9YLwUCjxY3S1qF1s4b94 pkhrMrdQaxazzTwzWvffrIZUSeClCyAJhK5d5YP8+L7rFNNz2w+rQj8FXiEID/SQCaqd tZWE7wXD/Xv0VN9FQw5I8yg8l6GiKcw1jJiaL1KgNz6OXt+XlgdGVtrZLCvuibcjta2j VIbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739828568; x=1740433368; h=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=kEp0V/uofLEq3T7XRrU9W7v2p/lNOOfnBaZ7yuPWtio=; b=L75nbjAFdY2ihuLCYfan/FT06CLLAA9IDVm2AX0ebYiv4hWv9xAPoZOerCYuzxq1Rg wrRUUOLPYCOKUBsyTdsMwM4IaJNmp2r8CpBhaQg7e+WPupY51GWoDkPwKsmcMG6WUaz1 lyEXUfiCaFv5mTVU4B6yow6jJWxCjNu9yAPxw9ocSqaMDYD+d6a1aT9RUKXYuIxXtyuQ fCtJfAbFyAyLyQcGazNP4eSMJdJVLSnJYPDswOyTvJH+lVlfpu0B9liSvQo0LLyN1W/f U/37e9mlBTgi27eOMCAU8FqvNXTKR+D+Yr9ZZPwSSee/N4+ac7aYSr3NAndprMpM6oA+ 8iAw== X-Forwarded-Encrypted: i=1; AJvYcCUpxrNQ/H6rFnIzjRvBGxuqxpPNUVfnQjozvhX2J1YEuKCYHD3SQMx4n/6fJyWjzjLjMDz/+k/YjSX3+r3w@postgresql.org X-Gm-Message-State: AOJu0YwmQ7U+fwXnnpBfZKDA/vUS4376AGm2krqp0wIlzEl+vsgNczG1 TO+HEeLU7dBZtG7Sn+597zqUi4IOgZtDoiNucvzQ4+79rfBTZ6Y3 X-Gm-Gg: ASbGncu27g0Lv6am5KmaxR+paHQVm+nKnZehC8E41H5aJW4Frc2S612cymgkz+xe0Gh Oju+rkzo+3ny4yrZf7vGbPPiUVrylekMuAgluk3LW2BGg7u6SDvEpV+pbQQp8xJlXfJgFbVYFk0 VUcbb3GdC6ZsllwubspPwMlG6mfjzbgwHsQqdHRHK3DId87QgRMpsnATvArmbBBQJAkaPMh6iqX EJ3rqBPK2lWRcsI9zzl0o7KkurNz5ElxL6I4Rw0CVBAGPSI/t/OwUhNJwImFPUFmJstMw8SSacM 8qy3lY8AvxUgZiMbMohR1h655q341UAU3wSALSrUOBmJWX0kxljLED7NjWJE8elSMeeVAz8DjC1 He1+dYQ== X-Google-Smtp-Source: AGHT+IED2BUnE3hr8US03wbMqIyOomHfhYvaG4lPmI8voswJfyTYuTi89+YSMHXGpPboHBAfCJSi6A== X-Received: by 2002:a05:6602:6d04:b0:855:9d17:b053 with SMTP id ca18e2360f4ac-8559d17b737mr360462639f.3.1739828566588; Mon, 17 Feb 2025 13:42:46 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4ed281717b0sm2329926173.46.2025.02.17.13.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 13:42:46 -0800 (PST) Date: Mon, 17 Feb 2025 15:42:44 -0600 From: Nathan Bossart To: Tom Lane Cc: Dean Rasheed , pgsql-hackers@postgresql.org Subject: Re: revamp row-security tracking Message-ID: References: <853593.1739815709@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <853593.1739815709@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Feb 17, 2025 at 01:08:29PM -0500, Tom Lane wrote: > I think you're being too impatient. It's still an interesting > topic, it just needs more thought to get to something committable. Maybe I am. Thanks for chiming in. > I find this has-row-security marking problem to be comparable > to the has-sublinks marking problem. We've had tons of > bugs-of-omission with that too, and the present code feels > ugly and not any less prone to omissions than it ever was. > > I wonder whether considering both problems together would yield any > insights, following Polya's dictum that "the more general problem may > be easier to solve". > > One straightforward idea is to just not do the marking at all, > but rather require places that want to know these properties > to do a fresh search of the query tree when they want to know > it. That obviously has performance questions to answer, but > it's easier to give answers to performance questions than > "is this correct" questions. That could be worth a try. The reason I started with the global queue idea was that we seem to reliably discover relations with RLS enabled, we just tend to miss propagating that information to the top-level query. We could invent a separate query tree walker for discovering RLS, etc. to keep it centralized. However, besides the performance questions, it would be another separate piece of code to keep updated. Perhaps another variation on this idea is to create a query walker that just looks for hasRowSecurity flags throughout the tree (and to use that to mark the plan cache entry appropriately). -- nathan