ALTER ROLE name [ [ WITH ] option [ ... ] ] 認麯䔇 option 埇傖滇 SUPERUSER | NOSUPERUSER | CREATEDB | NOCREATEDB | CREATEROLE | NOCREATEROLE | CREATEUSER | NOCREATEUSER | INHERIT | NOINHERIT | LOGIN | NOLOGIN | CONNECTION LIMIT connlimit | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password' | VALID UNTIL 'timestamp' ALTER ROLE name RENAME TO newname ALTER ROLE name SET configuration_parameter { TO | = } { value | DEFAULT } ALTER ROLE name RESET configuration_parameter
ALTER ROLE 媞櫹婔婻昄扞康蓐謾䔇匂攓㔗
認婻变傴䔇丸婔婻埻嘷埇傖媞櫹冽崔 CREATE ROLE 麯麵弄滯䔇蓐謾匂攓埇傖埗黙䕩庫欋喯釕诙埡䂖誗㔗欔橬埇脘䔇匂攓鄘橬傋䂉鍴庖嵂媹启役鍴潊叻噿係䔇锬釹幋崡(嘪䫘 GRANT 启 REVOKE 啔認傽庋)㔗澇橬婘变傴麯柊彄䔇匂攓䂘毕垄傸傖嬉䔇螆䘞㔗昄扞康轙亓䫘潙埇傖䂍傂嘘蓐謾櫹埻傂嘘螆䘞㔗拖橬 CREATEROLE 溄鍊䔇蓐謾埇傖媞櫹傂懟認底螆䘞嘖滇埻脘䂍麂轙亓䫘潙蓐謾螆䘞㔗捞锔䔇蓐謾埻脘媞櫹垄傸躻噌䔇埼傴㔗
丸庯婻埻䓉媞櫹蓐謾䔇劉䓄㔗昄扞康轙亓䫘潙埇傖媞櫹傂嘘蓐謾䔇劉䓄㔗拖橬 CREATEROLE 溄鍊䔇蓐謾埇傖䂍麂轙亓䫘潙誕臯麉变劉㔗嘷嬉嚔臺䔇䫘潙滇婉脘櫹劉䔇㔗套悩驔襕認幽啔媙釂傖埥崡婔婻䫘潙䔇躆傘誂毖㔗啹婺 MD5 媹凖䔇埼傴嘪䫘蓐謾劉庖嘩婺媹凖䔇䕊侐欔傖套悩埼傴滇 MD5 媹凖䔇闼幽䂍婔婻䫘潙櫹劉嚔橙䷺噽埼傴㔗
丸婬启丸啕婻埻嘷婺䬹垔䔇陉䘞埻麟媞櫹婔婻蓐謾䔇嚔臺䚺䩕唚㔗婘臖蓐謾锟劯嚔哋婔婻桄䔇嚔臺幋劯毺垔䔇昄唚嚔襖䕡 postgresql.conf 麯麵䔇潡蔙 postgres 变傴臯婪䔇埗昄蔯埻潊嚔臺䚺䩕唚㔗凹庯澇橬 LOGIN 溄鍊䔇蓐謾嚔臺䔇䚺䩕唚澇橬傔幽懟幬㔗捞锔䔇蓐謾埇傖櫹埻躻噌䔇嚔臺䚺䩕㔗轙亓䫘潙埇傖媞櫹傂嘘庺䔇嚔臺䚺䩕㔗拖橬 CREATEROLE 溄鍊䔇蓐謾埇傖䂍麂轙亓䫘潙媞櫹䚺䩕㔗橬底埻麟婉脘䫘認婻桹濘螆䘞潡蔙滇埻脘䫌轙亓䫘潙準螆䘞㔗
驔襕媞櫹匂攓䔇蓐謾䔇劉䓄
認底床埖媞櫹橔彺䫌 CREATE ROLE 螆䘞䔇匂攓埗黙臖变傴诙埡敘崔媇敇㔗
蓐謾䔇桄劉䓄
檪臖蓐謾毺垔䔇陉䘞埗昄䚺䩕唚螆䘞婺䂍垔唚㔗套悩 value 滇 DEFAULT 潡京昽䔇 RESET 彍役鍴䬹垔蓐謾䔇埻麟螆䘞認湙臖蓐謾儖婘桄䔇嚔臺麯䂓欪係䂘评啘䔇䚺䩕唚㔗嘪䫘 RESET ALL 橙䊖欔橬蓐謾䕩噿䔇螆䘞㔗
嘪䫘 CREATE ROLE 嵂媹桄蓐謾嘪䫘 DROP ROLE 役鍴斓蓐謾㔗
ALTER ROLE 婉脘櫹埻蓐謾䔇潊叻噿係㔗埇傖嘪䫘 GRANT 启 REVOKE 啔認婻庋愙㔗
嘪䫘認婻变傴毺垔婔婻橻媹凖䔇凖乕施媙釂償媄啹婺凖乕儖傖滯桺桹嚟嚹锕彄橉媇単幽婫埇脘赆垵潙䆇变傴寖埾螄嘘潡蔙赆橉媇単斖媖螄嘘㔗psql 寙劆婔婻埇傖䫘準垬噘媞櫹蓐謾凖乕䔇 \password 变傴㔗
幘埇傖檪嚔臺䚺䩕婯昄扞康䂏垔蔯婉滇婯蓐謾䂏垔埗黙 ALTER DATABASE 㔗套悩橬喾仕闼幽䬹垔庯蓐謾䔇螆䘞儖襖䕡䬹垔庯昄扞康䔇螆䘞㔗
櫹埻婔婻蓐謾䔇埼傴
ALTER ROLE davide WITH PASSWORD 'hu8jmn3';
櫹埻埼傴崌昽䔇斖橘弄滯埼傴庫臖婘 2015 幘 5 橽 4 斖婺剽崌昽施寺懫 UTC 斷婔婻償施
ALTER ROLE chris VALID UNTIL 'May 4 12:00:00 2015 +1';
傴婔婻埼傴愩誩橬昽
ALTER ROLE fred VALID UNTIL 'infinity';
䂍庽婔婻蓐謾录傺噽垄蓐謾启桄昄扞康䔇脘媕
ALTER ROLE miriam CREATEROLE CREATEDB;
䂍婔婻蓐謾螆䘞麂䚺䩕䔇 maintenance_work_mem 埗昄唚
ALTER ROLE worker_bee SET maintenance_work_mem = 100000;