Skip to content

Commit e8d9caa

Browse files
committed
Accept invalidation messages in InitializeSessionUserId().
If the authentication method modified the system catalogs through a separate database connection (say, to create a new role on the fly), make sure syscache sees the changes before we try to find the user. Author: Thomas Munro Reviewed-by: Tom Lane, Andres Freund Discussion: https://postgr.es/m/CAEepm%3D3_h0_cgmz5PMyab4xk_OFrg6G5VCN%3DnF4chFXM9iFOqA%40mail.gmail.com
1 parent 387a5cf commit e8d9caa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/backend/utils/init/miscinit.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include "storage/procarray.h"
4949
#include "utils/builtins.h"
5050
#include "utils/guc.h"
51+
#include "utils/inval.h"
5152
#include "utils/memutils.h"
5253
#include "utils/pidfile.h"
5354
#include "utils/syscache.h"
@@ -594,6 +595,13 @@ InitializeSessionUserId(const char *rolename, Oid roleid)
594595
/* call only once */
595596
AssertState(!OidIsValid(AuthenticatedUserId));
596597

598+
/*
599+
* Make sure syscache entries are flushed for recent catalog changes.
600+
* This allows us to find roles that were created on-the-fly during
601+
* authentication.
602+
*/
603+
AcceptInvalidationMessages();
604+
597605
if (rolename != NULL)
598606
{
599607
roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(rolename));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy