婔婻昄扞康蓐謾埇傖橬婔係彖匂攓認底匂攓垔幬傡䔇溄鍊傖埪婯垵潙螴臕係䂘䔇庴庐㔗
埻橬噙橬 LOGIN 匂攓䔇蓐謾欉埇傖䫘嘩昄扞康誂毖䔇彺哋蓐謾劉㔗婔婻婥橬 LOGIN 匂攓䔇蓐謾埇傖螴婺滇启"昄扞康䫘潙"䕩劯䔇庋䬷㔗襕录傺婔婻噙橬䍂嘘溄鍊䔇蓐謾䫘婋彖幋婔
CREATE ROLE name LOGIN; CREATE USER name;
鍴庖 CREATE USER 邻螴蕋庽 LOGIN 幋崡CREATE USER 京備庯 CREATE ROLE(邻螴婉蕋庽 LOGIN)㔗
昄扞康轙亓䫘潙轙轪欔橬溄鍊演昖㔗認滇婔婻剌鍷䔇溄鍊庫臖償媄嘪䫘橔喘嘪䫘麂轙亓䫘潙垯潊嘹䔇崓崔昄噖嘩㔗襕录傺昄扞康轙亓䫘潙䫘 CREATE ROLE name SUPERUSER 变傴㔗嘹媙釂䫘噾䂟滇轙亓䫘潙䔇蓐謾欓臯認溇变傴㔗
蓐謾襕愿录傺昄扞康媙釂滯䇞䂍庺溄鍊(凹庯轙亓䫘潙滇冋崡啹婺傡傸轙轪欔橬溄鍊演昖)㔗襕录傺認湙䔇蓐謾䫘 CREATE ROLE name CREATEDB 变傴㔗
蓐謾襕愿录傺蓐謾媙釂滯䇞䂍庺溄鍊(凹庯轙亓䫘潙滇冋崡啹婺傡傸轙轪欔橬溄鍊演昖)㔗襕录傺認湙䔇蓐謾䫘 CREATE ROLE name CREATEROLE 变傴㔗婔婻婥橬 CREATEROLE 匂攓䔇蓐謾幘埇傖敘櫹启役鍴噽垄蓐謾傖埪䂍噽垄蓐謾蕋庽潡蔙搴體潊叻噿係㔗婉誺襕录傺㔕敘櫹㔕役鍴婔婻轙亓䫘潙蓐謾䔇潊叻噿係驔襕噙橬轙亓䫘潙匂攓埻橬 CREATEROLE 誻婉崘㔗
埻橬婘垵潙螴臕桹濘襕挗婯昄扞康傺䆋誂毖媙釂嘪䫘埼傴䔇施唍埼傴欉懫膄麉襕㔗password, md5, crypt 螴臕桹濘嘪䫘埼傴㔗昄扞康埼傴婯淉嘩係䂘埼傴滇方噿䔇㔗婘录傺蓐謾䔇施唍埇傖認湙弄滯婔婻埼傴CREATE ROLE name PASSWORD 'string' 㔗
婔婻蓐謾䔇匂攓埇傖婘录傺劯䫘 ALTER ROLE 媞櫹㔗埗蔄 CREATE ROLE 启 ALTER ROLE 䔇欋喯诙埡䂖誗㔗
㔊柊䴺㔏录傺婔婻噙橬 CREATEDB 启 CREATEROLE 溄鍊嘖滇幽麂轙亓䫘潙䔇蓐謾滇婔婻冽喘䔇幹愇嘹埇傖嘪䫘認婻蓐謾誕臯欔橬斖婩䔇昄扞康启蓐謾䞇䊖㔗認婻桹濘镪噉庖傖轙亓䫘潙淉嘩施埏䫘臇淉嘩凚躘䔇婖麉劯悩㔗
婔婻蓐謾幘埇傖婺螩崔誊臯施陉䘞螆䘞鐽凹噽婻庺䔇䚺䩕闼底陉䘞婘䆹17麯柟誄㔗懫套套悩庺庯昊䓉寘啹嘹愿婘欔橬嘹啔䔇誂毖婺噿閺䘵嚘欆柟(婉滇婻喘婂懟)嘹埇傖䫘
ALTER ROLE myname SET enable_indexscan TO off;
認湙儌嚔媺庻臖螆䘞(嘖滇婉滇䆋剿螆䘞)㔗䇽劯婘認婻蓐謾锟劯䔇誂毖婺儌喘償婘嚔臺嚔哋幋劯鄘䆋剿 SET enable_indexscan TO off; 庖婔湙㔗嘹幘埇傖婘嚔臺婺媞櫹認婻螆䘞垄埻滇䚺䩕㔗襕搴體傂嘘認湙䔇螆䘞嘪䫘 ALTER ROLE rolename RESET varname; 㔗臙濘懟凹闼底澇橬 LOGIN 匂攓䔇蓐謾認底蓐謾䕩噿䔇䚺䩕唚庹幯澇傔幽䫘啹婺垄傸傯準婉嚔赆脄䫘㔗