PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔媆誕嬉誕

SET

劉䓄

SET -- 媞櫹誊臯施埗昄

臺濘

SET [ SESSION | LOCAL ] configuration_parameter { TO | = } { value | 'value' | DEFAULT }
SET [ SESSION | LOCAL ] TIME ZONE { timezone | LOCAL | DEFAULT }

柟誄

SET 变傴媞櫹誊臯施陉䘞埗昄㔗螩崔婘䆹17麯麵彖庺䔇誊臯施埗昄埇傖䫘 SET 婘誊臯施螆䘞㔗嘖滇橬底襕挗嘪䫘轙亓䫘潙溄鍊準媞櫹蔯噽垄橬底彍婘橉媇単潡蔙嚔臺嚔哋幋劯婉脘媞櫹㔗臙濘懟 SET 埻嘌巉嘷嬉嚔臺嘪䫘䔇昄唚㔗

套悩 SETSET SESSION 滇婘婔婻䘉劯锔庺䔇庋媇麯埏庺䔇闼幽 SET 变傴䔇昽悩儖婘庋媇啂悔幋劯潽崌㔗婔斥寙啘垄䔇庋媇柊庴闼幽噽昽悩儖毕䂺彄庋媇䔇䂷溘鍴麂赆埥崡婔婻 SET 襖䕡㔗

婉䞇滇劥柊庴SET LOCAL 䔇昽悩埻毕䂺彄嘷嬉庋媇䂷溘㔗婔婻䬹冋滇婘婔婻庋媇麯麵䔇 SET 劯麵虘五婔婻 SET LOCAL 婘庋媇䂷溘幋嬉埻脘䩋彄 SET LOCAL 䔇昄唚嘖滇幋劯(套悩庋媇柊庴)彍滇 SET 䔇唚䫘昽㔗

埗昄

SESSION

弄滯認婻变傴埻凹嘷嬉嚔臺蕙嘩䫘㔗套悩 SESSIONLOCAL 鄘澇庺䯄闼幽認婻滇䚺䩕㔗

LOCAL

弄滯臖变傴埻婘嘷嬉庋媇婺橬昽㔗婘 COMMITROLLBACK 幋劯嚔臺亓彆䔇螆䘞儖喉渇䫘昽㔗臙濘懟套悩婘 BEGIN 庖幋崡誊臯闼幽 SET LOCAL 儖臘䯄庺澇橬嘩䫘啹婺庋媇儖䆋剿䂷溘㔗

configuration_parameter

埇螆䘞䔇誊臯施埗昄䔇劉庖㔗埇䫘䔇埗昄婘䆹17启婋麵橬桺懼㔗

value

埗昄䔇桄唚㔗唚埇傖弄滯婺庖严婾婩麟㔕湺臖严㔕昄庖潡蔙锖埙彖锫䔇婪麵認底婩薪䔇彖臘㔗DEFAULT 埇傖䫘庯檪認底埗昄螆䘞婺垄傸䔇䚺䩕唚㔗

鍴庖婘䆹17麯麵橬桺懼螄蘘䔇陉䘞埗昄幋崡誻橬庹婻埻脘䫘 SET 变傴螆䘞潡蔙滇橬䬹枪䔇臺濘䔇埗昄㔗

NAMES

SET NAMES valueSET client_encoding TO value 䔇彆劉㔗

SEED

婺锟橺昄䫘潊単(庘昄 random)螆䘞喙鄘䔇䓉床㔗噕螩䔇唚滇傋庯 0 启 1 幋閘䔇敞䗹昄䇽劯垄嚔赆幻傖 231-1

幘埇傖锔誺脄䫘 setseed 庘昄準螆䘞䓉床

SELECT setseed(value);
TIME ZONE

SET TIME ZONE valueSET timezone TO value 䔇婔婻彆劉㔗臺濘 SET TIME ZONE 噕螩婺施寺螆䘞䬹枪䔇臺濘㔗婋麵滇橬昽唚䔇冋床

'PST8PDT'

媹噂嚇噋彷䔇施寺

'Europe/Rome'

懟崓彷施寺

-7

UTC 傖薪 7 償施䔇施寺(京昽庯 PDT)

INTERVAL '-08:00' HOUR TO MINUTE

UTC 傖薪 8 償施䔇施寺(京昽庯 PST)

LOCAL
DEFAULT

儖施寺螆䘞婺嘹䔇橸婄施寺(橉媇単淉嘩係䂘䚺䩕䔇闼婻)

埗黙 誗8.5.3 诙埡橬噿施寺䔇敘崔䂖誗㔗

濘懟

庘昄 set_config 柊冕庖京昽䔇媘脘㔗埗黙誗9.20

冋床

螆䘞昇嚟抩䘵虇冇

SET search_path TO my_schema, public;

檪斖橘施閘鼯湚螆䘞婺嚹䂘䔇 POSTGRES 鼯湚(斖婘橽嬉)

SET datestyle TO postgres, dmy;

檪施寺螆䘞婺媹噂嚇噋彷

SET TIME ZONE 'PST8PDT';

婺懟崓彷螆䘞施寺

SET TIME ZONE 'Europe/Rome';

噚垹攓

SET TIME ZONE 欷匘庖婘 SQL 湺庖麯垔幬䔇臺濘㔗湺庖埻噕螩橬婔婻昄庖施寺啟䓂蔯 PostgreSQL 誻噕螩垯昘敘䕕昂䔇施寺弄滯㔗欔橬噽垄䔇 SET 䬹攓鄘滇 PostgreSQL 欷匘㔗

埽蓕

RESET, SHOW

劯锔饡釕嬉誕
SELECT INTO婪婔亓SET CONSTRAINTS