已合并
修复用户链接时候B库用户名查找问题 #9061
superlchf创建于 3月12日
修复用户链接时候B库用户名查找问题 #9061
已合并
共 1 个文件变更+3-5
| @@ -2463,8 +2463,9 @@ extern char* GetDatabaseCompatibility(const char* dbname); | |||
| 2463 | HeapTuple SearchUserHostName(const char* userName, Oid* oid) | 2463 | HeapTuple SearchUserHostName(const char* userName, Oid* oid) |
| 2464 | { | 2464 | { |
| 2465 | char* userHostName = NULL; | 2465 | char* userHostName = NULL; |
| 2466 | - HeapTuple roleTup = NULL; | 2466 | + HeapTuple roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(userName)); |
| 2467 | - if (u_sess->attr.attr_common.b_compatibility_user_host_auth && (!OidIsValid(u_sess->proc_cxt.MyDatabaseId) || u_sess->proc_cxt.check_auth) && u_sess->proc_cxt.MyProcPort) { | 2467 | + if (!roleTup && u_sess->attr.attr_common.b_compatibility_user_host_auth && |
| 2468 | + (!OidIsValid(u_sess->proc_cxt.MyDatabaseId) || u_sess->proc_cxt.check_auth) && u_sess->proc_cxt.MyProcPort) { | ||
| 2468 | bool isBFormat = false; | 2469 | bool isBFormat = false; |
| 2469 | char* dbCompatibility = GetDatabaseCompatibility(u_sess->proc_cxt.MyProcPort->database_name); | 2470 | char* dbCompatibility = GetDatabaseCompatibility(u_sess->proc_cxt.MyProcPort->database_name); |
| 2470 | if (dbCompatibility) | 2471 | if (dbCompatibility) |
| @@ -2486,9 +2487,6 @@ HeapTuple SearchUserHostName(const char* userName, Oid* oid) | |||
| 2486 | } | 2487 | } |
| 2487 | } | 2488 | } |
| 2488 | } | 2489 | } |
| 2489 | - if (!roleTup) { | ||
| 2490 | - roleTup = SearchSysCache1(AUTHNAME, PointerGetDatum(userName)); | ||
| 2491 | - } | ||
| 2492 | if (roleTup && oid) | 2490 | if (roleTup && oid) |
| 2493 | *oid = HeapTupleGetOid(roleTup); | 2491 | *oid = HeapTupleGetOid(roleTup); |
| 2494 | return roleTup; | 2492 | return roleTup; |