The fast path required table-level SELECT on the referenced table, rejecting checks that the SPI path allows with column-level grants. It also omitted the UPDATE privilege required by FOR KEY SHARE. When table privileges do not suffice, use ExecCheckOneRelPerms() with the referenced key columns as selectedCols and an empty updatedCols. This accepts SELECT on all referenced columns and UPDATE on any column, the same privileges the executor would require for the SELECT ... FOR KEY SHARE the SPI path runs. Keep the table-privilege check as a shortcut that avoids constructing a column bitmap in the usual case. Add missing regression test coverage for the fixed cases. Reported-by: Nikolay Samokhvalov <nik@postgres.ai> Author: Nikolay Samokhvalov <nik@postgres.ai> Co-authored-by: Amit Langote <amitlangote09@gmail.com> Discussion: https://www.postgr.es/m/CAM527d9BgPjeOOYmbCBTd57R145qHCk-dzw9qNq%2BnOrDq1j__A%40mail.gmail.com Backpatch-through: 19
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/19/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/19/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.