postgresql/src/backend
Joe Conway b12bd4869b Fix has_column_privilege function corner case
According to the comments, when an invalid or dropped column oid is passed
to has_column_privilege(), the intention has always been to return NULL.
However, when the caller had table level privilege the invalid/missing
column was never discovered, because table permissions were checked first.

Fix that by introducing extended versions of pg_attribute_acl(check|mask)
and pg_class_acl(check|mask) which take a new argument, is_missing. When
is_missing is NULL, the old behavior is preserved. But when is_missing is
passed by the caller, no ERROR is thrown for dropped or missing
columns/relations, and is_missing is flipped to true. This in turn allows
has_column_privilege to check for column privileges first, providing the
desired semantics.

Not backpatched since it is a user visible behavioral change with no previous
complaints, and the fix is a bit on the invasive side.

Author: Joe Conway
Reviewed-By: Tom Lane
Reported by: Ian Barwick
Discussion: https://postgr.es/m/flat/9b5f4311-157b-4164-7fe7-077b4fe8ed84%40joeconway.com
2021-03-31 13:55:25 -04:00
..
access Accept slightly-filled pages for tuples larger than fillfactor. 2021-03-30 18:53:44 -07:00
bootstrap Allow composite types in catalog bootstrap 2021-03-24 00:47:52 +01:00
catalog Fix has_column_privilege function corner case 2021-03-31 13:55:25 -04:00
commands Rework planning and execution of UPDATE and DELETE. 2021-03-31 11:52:37 -04:00
executor Rework planning and execution of UPDATE and DELETE. 2021-03-31 11:52:37 -04:00
foreign Update copyright for 2021 2021-01-02 13:06:25 -05:00
jit Use errmsg_internal for debug messages 2021-02-17 11:33:25 +01:00
lib Update copyright for 2021 2021-01-02 13:06:25 -05:00
libpq Allow matching the DN of a client certificate for authentication 2021-03-29 15:49:39 -04:00
main Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes Rework planning and execution of UPDATE and DELETE. 2021-03-31 11:52:37 -04:00
optimizer Rework planning and execution of UPDATE and DELETE. 2021-03-31 11:52:37 -04:00
parser Allow an alias to be attached to a JOIN ... USING 2021-03-31 17:10:50 +02:00
partitioning ALTER TABLE ... DETACH PARTITION ... CONCURRENTLY 2021-03-25 18:00:28 -03:00
po Translation updates 2020-05-18 12:49:30 +02:00
port Use errmsg_internal for debug messages 2021-02-17 11:33:25 +01:00
postmaster Add support for asynchronous execution. 2021-03-31 18:45:00 +09:00
regex Further tweak memory management for regex DFAs. 2021-03-08 16:32:29 -05:00
replication Add a xid argument to the filter_prepare callback for output plugins. 2021-03-30 10:34:43 +05:30
rewrite Rework planning and execution of UPDATE and DELETE. 2021-03-31 11:52:37 -04:00
snowball Update snowball 2021-02-19 08:10:15 +01:00
statistics Extended statistics on expressions 2021-03-27 00:01:11 +01:00
storage Add support for asynchronous execution. 2021-03-31 18:45:00 +09:00
tcop Extended statistics on expressions 2021-03-27 00:01:11 +01:00
tsearch Don't leak compiled regex(es) when an ispell cache entry is dropped. 2021-03-18 22:22:47 -04:00
utils Fix has_column_privilege function corner case 2021-03-31 13:55:25 -04:00
.gitignore
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Add missing gettext triggers 2020-04-28 13:35:40 +02:00