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.96) (envelope-from ) id 1vqe8Q-00F4AL-0t for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Feb 2026 21:22:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vqe8P-00BMlV-1Q for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Feb 2026 21:22:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vqe8P-00BMlN-0T for pgsql-hackers@lists.postgresql.org; Thu, 12 Feb 2026 21:22:01 +0000 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vqe8O-00000000Nic-0112 for pgsql-hackers@postgresql.org; Thu, 12 Feb 2026 21:22:01 +0000 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-40866608701so166873fac.1 for ; Thu, 12 Feb 2026 13:21:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770931317; x=1771536117; 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=ztWMiC6zDFzXBmJeQLqKK8tevCtYG/THsQcAW5n+/Ug=; b=USd0ahoykw61x1MgVn6EXmV9IMMB504lQJbPG7+OoOyryd9/D28FL2YK+cSSIH2PHb d4FfV6u1tHLt5jzvQo5vbHkfU1TxeOY9AjtNIvYttHM3ix5ZgJc3Em0rDwV8RiInOje5 EzdAkgQMv3ReFq/Knnr/tIT0ZSaT51eiqsJZVP5ZvtyXf/zZn9e8gys8c/6lW/OuWGem 05/LjPTRdkTm7l4Y4bpeLYYQd9KWNXIBV7A+qx9Gm1qvWiK3Qo+mLSUqQ/f1n3t+Nt+2 GxWN4mp8TTXDf6NDdwxrgyFjFIN2HF3O1R3n7KEZvp3Q0IsZ1mWLmdFpfEe+RrpKZFJZ j5Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770931317; x=1771536117; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ztWMiC6zDFzXBmJeQLqKK8tevCtYG/THsQcAW5n+/Ug=; b=SxduzpPkq/o+J39wmpJuOvcyEW6kYDWEGpSuHlO1Nh5GOQYz/ZTgPUFgfpD74RrB0a 3VqCePWaDad+Tx+O8jSMyvVtU4CG05DqSyJNfJf8pFf5pwzP3IQ+bOwKkqML6epJO2vM ju1aL4jbJn+AoPF1yZnxOBTJwkkaVYCq2qERtWQar3sS5dXo+HcfACdOEnluq53WJdNT Cr38Ks4aRk+nF63mS939IkWrqtabRHuSp9PbB7BsSCmS1hEnA8VYy+PQZLDPvVxgGkkl Lv9AB9PPvM8hv1vlZ5CmkEWu1pLvhD6Q/9w9q1auqpW2vlZmrEgaZn6IaPjVkThGyM0P EuZA== X-Forwarded-Encrypted: i=1; AJvYcCVD0DLq7m3hwv57YgsEiF3/netKgoar00MCypB/BTyp664BsKconw4G0fLJCB4qi95i5iCxF4vIwpqZSjc+@postgresql.org X-Gm-Message-State: AOJu0YxK9+WuiX8lfaMxsMwW9t3bM/gGQ1XciJw3hZ2AdT9FrsGQExZo PmtO30+tdNKMVHP+QHF135a+StEOrvdt8+9vZFz1bW0JJhxqjrAxUrQe X-Gm-Gg: AZuq6aKdGs1HjenU9IgoWK/Nll6EoAT13lmX01yfgRveb0nJAuO7vwBV4kOHaeZ3cxr YQZQog7EwcqVNH16u1sy0k87cZdRib3q7xCPj0VD5yyHlgCJXOfr+Sa4mwQWutvKg/84QhRRJ9p ITtTOw5eU5g0CUCXaBG2vFdjHDjUkzPh3pLhwvAuLg6Z0Xd3+qlZX3fJtLtBwmuxOXZ/w5Jq41t YvTvPc3XyeqjsL4l6ugflOoy+O2NNBNcLJZxQ4rv1uY8smxHhTG1/tblXuMwUunCAIEXjV2aM1+ lVFI0C2eMuiLo5577y1NvpX7CPQE7mTu93lvkeD9BEGO7O9uuzizzgqOY6AAYKq2mA7N5AuhffG k8a+xzkDZt8rMVCwV2980X5IPfWUmg22cTb7sTfatoYiLY3e3EyQCFWJ4JgKS75TTyE5y0YFIy3 gVUwHJsT577/GFwNX7+PJo0l2rWXPdVn8kba7QWES7TJVzTVuXnLXHlSLKYe+/jfIzK+K9UImG1 lk/A1d9uoDGVdR8plSunfUjkGk= X-Received: by 2002:a05:6870:9618:b0:315:b768:bd1d with SMTP id 586e51a60fabf-40eee76f082mr95254fac.6.1770931317420; Thu, 12 Feb 2026 13:21:57 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-40eaf103ac3sm4564601fac.11.2026.02.12.13.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Feb 2026 13:21:56 -0800 (PST) Date: Thu, 12 Feb 2026 15:21:54 -0600 From: Nathan Bossart To: Nitin Motiani Cc: Dilip Kumar , pgsql-hackers@postgresql.org Subject: Re: [PATCH] Support reading large objects with pg_read_all_data Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Feb 10, 2026 at 06:39:18PM +0530, Nitin Motiani wrote: > I updated the commit message according to this suggestion. Thanks for the new patch. Please create a commitfest entry so that this patch 1) isn't forgotten and 2) gets tested by cfbot. pg_read_all_data allows reading all data (tables, - views, sequences), as if having SELECT rights on - those objects and USAGE rights on all schemas. This + views, sequences, and large objects), as if having + SELECT rights on those objects and + USAGE rights on all schemas. This nitpick: I usually try to make small doc updates in a way that doesn't disturb the surrounding lines so that we retain as much git history as possible. For example, in this case, I would've probably done something like: pg_read_all_data allows reading all data (tables, - views, sequences), as if having SELECT rights on + views, sequences, large objects), as if having SELECT rights on those objects and USAGE rights on all schemas. This Of course, this isn't always possible, and opinions may vary... +\c - +-- confirm pg_read_all_data implies read access to large objects +SELECT lowrite(lo_open(1002, x'20000'::int), 'hello world'); + +SET SESSION AUTHORIZATION regress_priv_user6; +SELECT has_largeobject_privilege(1002, 'SELECT'); -- true +SELECT has_largeobject_privilege(1002, 'UPDATE'); -- false +SELECT lo_get(1002); -- ok +SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); -- fail +do $$ +declare + fd int; +begin + fd := lo_open(1002, x'40000'::int); + perform lo_lseek(fd, 6, 0); + raise notice 'position after lseek: %', lo_tell(fd); + raise notice 'data read: %', loread(fd, 5); + raise notice 'position after loread: %', lo_tell(fd); + perform lo_close(fd); +end; +$$; + +\c - +SELECT lo_truncate(lo_open(1002, x'20000'::int), 0); -- ok I'd suggest simplifying this a bit by borrowing some lines from the surrounding tests. I don't think we need to test lo_lseek and friends because (IIUC) those don't need to do ACL checks. Here's a rough idea of what I'm thinking: +\c - +-- confirm member of pg_read_all_data can read large objects +SET SESSION AUTHORIZATION regress_priv_user6; + +SELECT loread(lo_open(1002, x'40000'::int), 32); +SELECT lo_get(1002); +SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); -- to be denied +SELECT lo_unlink(1002); -- to be denied +SELECT lo_truncate(lo_open(1002, x'20000'::int), 10); -- to be denied +SELECT lo_put(1002, 1, 'abcd'); -- to be denied Later on, there's also this change: -SELECT has_largeobject_privilege('regress_priv_user6', 1008, 'SELECT'); -- no +SELECT has_largeobject_privilege('regress_priv_user6', 1008, 'SELECT'); -- yes I think the point of this test is to have a negative case, so we should probably switch it to another role that doesn't have privileges on the large object. But it wouldn't hurt to also verify has_largeobject_privilege() works as expected for members of pg_read_all_data. -- nathan