!3123 解决兼容性B库下,alter user password不支持'user'@'host'的问题
Merge pull request !3123 from 王修强/user_host_bug_1
This commit is contained in:
@ -104,7 +104,7 @@ bool get_stored_password(const char* role, password_info* pass_info)
|
||||
t_thrd.int_cxt.ImmediateInterruptOK = false;
|
||||
|
||||
/* Get role info from pg_authid */
|
||||
if (strchr(role, '@'))
|
||||
if (strchr(role, '@') && !OidIsValid(u_sess->proc_cxt.MyDatabaseId))
|
||||
ereport(ERROR,(errcode(ERRCODE_INVALID_NAME),errmsg("@ can't be allowed in username")));
|
||||
roleTup = SearchUserHostName(role, NULL);
|
||||
|
||||
@ -167,7 +167,7 @@ static bool GetValidPeriod(const char *role, password_info *passInfo)
|
||||
t_thrd.int_cxt.ImmediateInterruptOK = false;
|
||||
|
||||
/* Get role info from pg_authid */
|
||||
if (strchr(role, '@'))
|
||||
if (strchr(role, '@') && !OidIsValid(u_sess->proc_cxt.MyDatabaseId))
|
||||
ereport(ERROR,(errcode(ERRCODE_INVALID_NAME),errmsg("@ can't be allowed in username")));
|
||||
HeapTuple roleTup = SearchUserHostName(role, NULL);
|
||||
if (!HeapTupleIsValid(roleTup)) {
|
||||
|
||||
@ -37,6 +37,7 @@ create table test1(a int);
|
||||
alter table test1 owner to 'test_user_host'@'%';
|
||||
GRANT ALL PRIVILEGES TO 'test_user_host'@'%';
|
||||
REVOKE ALL PRIVILEGES FROM 'test_user_host'@'%';
|
||||
ALTER USER 'test_user_host'@'%' password 'test@123';
|
||||
ALTER USER 'test_user_host'@'%' RENAME TO 'test_user_host'@'1%';
|
||||
CREATE DEFINER='test_user_host'@'127.0.%' FUNCTION test_func(integer, integer) RETURNS integer SECURITY INVOKER
|
||||
AS 'select $1 + $2;'
|
||||
|
||||
@ -87,6 +87,7 @@ create table test1(a int);
|
||||
alter table test1 owner to 'test_user_host'@'%';
|
||||
GRANT ALL PRIVILEGES TO 'test_user_host'@'%';
|
||||
REVOKE ALL PRIVILEGES FROM 'test_user_host'@'%';
|
||||
ALTER USER 'test_user_host'@'%' password 'test@123';
|
||||
ALTER USER 'test_user_host'@'%' RENAME TO 'test_user_host'@'1%';
|
||||
CREATE DEFINER='test_user_host'@'127.0.%' FUNCTION test_func(integer, integer) RETURNS integer SECURITY INVOKER
|
||||
AS 'select $1 + $2;'
|
||||
|
||||
Reference in New Issue
Block a user