postgresql/src/include
Robert Haas 6566133c5f Ensure that pg_auth_members.grantor is always valid.
Previously, "GRANT foo TO bar" or "GRANT foo TO bar GRANTED BY baz"
would record the OID of the grantor in pg_auth_members.grantor, but
that role could later be dropped without modifying or removing the
pg_auth_members record. That's not great, because we typically try
to avoid dangling references in catalog data.

Now, a role grant depends on the grantor, and the grantor can't be
dropped without removing the grant or changing the grantor.  "DROP
OWNED BY" will remove the grant, just as it does for other kinds of
privileges. "REASSIGN OWNED BY" will not, again just like what we do
in other cases involving privileges.

pg_auth_members now has an OID column, because that is needed in order
for dependencies to work. It also now has an index on the grantor
column, because otherwise dropping a role would require a sequential
scan of the entire table to see whether the role's OID is in use as
a grantor. That probably wouldn't be too large a problem in practice,
but it seems better to have an index just in case.

A follow-on patch is planned with the goal of more thoroughly
rationalizing the behavior of role grants. This patch is just trying
to do enough to make sure that the data we store in the catalogs is at
some basic level valid.

Patch by me, reviewed by Stephen Frost

Discussion: http://postgr.es/m/CA+TgmoaFr-RZeQ+WoQ5nKPv97oT9+aDgK_a5+qWHSgbDsMp1Vg@mail.gmail.com
2022-08-18 13:13:02 -04:00
..
access Add missing parenthesis to max item size macro. 2022-08-05 13:06:19 -07:00
backup Move basebackup code to new directory src/backend/backup 2022-08-10 14:03:23 -04:00
bootstrap Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
catalog Ensure that pg_auth_members.grantor is always valid. 2022-08-18 13:13:02 -04:00
commands Fix comment in copyfrom_internal.h 2022-08-06 21:13:45 +09:00
common Remove replacement code for getaddrinfo. 2022-08-14 09:53:28 +12:00
datatype Fix overflow hazards in interval input and output conversions. 2022-04-02 16:12:29 -04:00
executor Remove unused fields from ExprEvalStep 2022-08-03 09:46:02 +12:00
fe_utils Add xheader_width pset option to psql 2022-07-25 14:25:02 -04:00
foreign Update copyright for 2022 2022-01-07 19:04:57 -05:00
jit Add central declarations for dlsym()ed symbols 2022-07-17 17:23:42 -07:00
lib Add missing inequality searches to rbtree 2022-07-08 22:00:03 +03:00
libpq Remove configure probe for netinet/tcp.h. 2022-08-18 16:31:11 +12:00
mb Simplify coding style of is_valid_ascii() 2022-08-05 16:50:22 +07:00
nodes Improve performance of adjust_appendrel_attrs_multilevel. 2022-08-18 12:36:16 -04:00
optimizer Improve performance of adjust_appendrel_attrs_multilevel. 2022-08-18 12:36:16 -04:00
parser Update comment in gramparse.h 2022-08-18 09:45:05 +07:00
partitioning Have ExecFindPartition cache the last found partition 2022-08-02 09:55:27 +12:00
port Remove configure probe for netinet/tcp.h. 2022-08-18 16:31:11 +12:00
portability Fix obsolete comments in instr_time.h. 2022-08-09 11:50:03 +12:00
postmaster Add central declarations for dlsym()ed symbols 2022-07-17 17:23:42 -07:00
regex Remove configure probe for wctype.h. 2022-07-23 16:54:00 +12:00
replication Remove replacement code for getaddrinfo. 2022-08-14 09:53:28 +12:00
rewrite Update copyright for 2022 2022-01-07 19:04:57 -05:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Add stxdinherit flag to pg_statistic_ext_data 2022-01-16 13:38:01 +01:00
storage Remove configurability of PPC spinlock assembly code. 2022-08-13 13:36:39 -04:00
tcop Allow event trigger table_rewrite for ALTER MATERIALIZED VIEW 2022-08-17 14:55:20 +09:00
tsearch Remove configure probe for wctype.h. 2022-07-23 16:54:00 +12:00
utils Remove configure probe for sys/resource.h and refactor. 2022-08-14 00:09:47 +12:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Remove configure probes for sys/un.h and struct sockaddr_un. 2022-08-14 00:09:47 +12:00
fmgr.h Mark all symbols exported from extension libraries PGDLLEXPORT. 2022-07-17 18:50:14 -07:00
funcapi.h Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
getopt_long.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
Makefile Install generated nodes/nodetags.h 2022-07-09 10:20:23 +02:00
miscadmin.h Process session_preload_libraries within InitPostgres's transaction. 2022-07-25 10:27:43 -04:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Remove configurability of PPC spinlock assembly code. 2022-08-13 13:36:39 -04:00
pg_config.h.in Remove configure probe for netinet/tcp.h. 2022-08-18 16:31:11 +12:00
pg_getopt.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pg_trace.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgstat.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pgtar.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgtime.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
port.h Remove HAVE_UNIX_SOCKETS. 2022-08-14 08:46:53 +12:00
postgres_ext.h Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
postgres_fe.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
postgres.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
windowapi.h Update copyright for 2022 2022-01-07 19:04:57 -05:00