SET

Ãû³Æ

SET ¡ª Ϊ»á»°ÉèÖÃÔËÐÐʱ²ÎÊý

Óï·¨

SET variable { TO | = } { value | 'value' | DEFAULT }
SET CONSTRAINTS {ALL | constraintlist} mode
SET TIME ZONE { 'timezone' | LOCAL | DEFAULT }
SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
  

ÊäÈë

variable
¿ÉÉèÖõÄÈ«¾Ö±äÁ¿£®
value
²ÎÊýµÄÐÂÖµ£®DEFAULT ¿ÉÒÔÓÃÓÚÉùÃ÷°Ñ²ÎÊý»Ö¸´ÎªÈ±Ê¡Öµ£®ÔÊÐíʹÓÃ×Ö´®Êý×飬µ«ÊǸü¸´ÔӵĽṹÐèÒªÓõ¥ÒýºÅ»òÕßË«ÒýºÅÒýÆðÀ´£®
¿ÉÄܵıäÁ¿ºÍÐí¿ÉµÄÖµÊÇ£®
 
CLIENT_ENCODING | NAMES
ÉèÖöà×Ö½Ú¿Í»§¶Ë±àÂë¡£²ÎÊýÊÇ£º
value

 
°Ñ¿Í»§¶Ë¶à×Ö½Ú±àÂëÉèΪ value¡£ÉùÃ÷µÄ±àÂ뷽ʽ±ØÐëΪºó¶ËÖ§³Ö¡£

 
Õâ¸öÌØÐÔÖ»ÓÐÔÚ¶ÔÖÆ×÷ Postgres µÄÅäÖý׶ÎÉùÃ÷ÁË MULTIBYTE Ö§³Öºó²ÅÉúЧ¡£

 
DATESTYLE
ÉèÖÃÈÕÆÚ/ʱ¼ä±íʾ·ç¸ñ¡£Ó°ÏìÊä³ö¸ñʽ£¬²¢ÇÒÔÚijЩʱºò»áÓ°ÏìÊäÈëµÄ½âÊÍ¡£

 
ISO
ʹÓà ISO 8601-·ç¸ñµÄÈÕÆÚºÍʱ¼ä
SQL
ʹÓà Oracle/Ingres-·ç¸ñµÄÈÕÆÚºÍʱ¼ä
Postgres
ʹÓô«Í³ Postgres ¸ñʽ
European
ʹÓà dd/mm/yyyy ×÷ΪÊý×ÖÈÕÆÚ±í´ïʽ£®
NonEuropean
ʹÓà mm/dd/yyyy ×÷ΪÊý×ÖÈÕÆÚ±í´ïʽ£®
German
ʹÓà dd.mm.yyyy ×÷ΪÊý×ÖÈÕÆÚ±í´ïʽ£®
US
Óë 'NonEuropean'Ò»Ñù
DEFAULT

 
»Ö¸´È±Ê¡Öµ £¨ISO£©
ÈÕÆÚ¸ñʽ³õʼ»¯¿ÉÒÔÓÃÏÂÃæ·½·¨³õʼ»¯£º
 
ÉèÖà PGDATESTYLE »·¾³±äÁ¿£®Èç¹ûÒ»¸ö»ùÓÚ libpq µÄ¿Í»§¶ËµÄ»·¾³ÀïÉèÖÃÁË PGDATESTYLE£¬libpq ½«ÔÚÁª½ÓÆô¶¯Ê±×Ô¶¯°Ñ DATESTYLE ÉèÖóÉΪ PGDATESTYLE µÄÖµ¡£
Óà-o -e ²ÎÊýÔËÐÐ postmaster ¿ÉÒÔ°ÑÈÕÆÚÉèÖÃ³É European Ï°¹ß£®Òª×¢ÒâµÄÊÇÕâ¸öÖ»ÊǶÔһЩÈÕÆÚ·ç¸ñµÄ×éºÏÓÐÓ°Ï죻ÀýÈç ISO ·ç¸ñ²»±»Õâ¸ö²ÎÊýÓ°Ï죮
¸Ä±ä src/backend/utils/init/globals.cÀïµÄ±äÁ¿£®

ÔÚ globals.c Àï¿ÉÒÔ¸ü¸ÄµÄ±äÁ¿ÊÇ£º
 
bool EuroDates = false | true 
int DateStyle = USE_ISO_DATES | USE_POSTGRES_DATES | USE_SQL_DATES | USE_GERMAN_DATES 

SEED

ΪËæ»úÊýÉú³ÉÆ÷ÉèÖÃÄÚ²¿ÖÖ×Ó£®
value

ÖÖ×ÓµÄÖµ±»Ëæ»ú·¶Î§º¯ÊýʹÓ㮵äÐ͵ÄÖµÊǽéÓÚ0 ºÍ 1Ö®¼äµÄ¸¡µãÊý£¬Õâ¸öÊýËæºó³ËÒÔ RAND_MAX£®Èç¹ûʹÓÃÁ˳¬³ö·¶Î§µÄÊýÖµ£¬Éú³ÉµÄ»ýÒþº¬µØÒç³ö£®

ÖÖ×Ó»¹¿ÉÒÔͨ¹ýµ÷Óà setseed SQL º¯ÊýÉèÖãº

SELECT setseed(value);
Õâ¸öÌØÐÔÖ»ÓÐÔÚ¶ÔÖÆ×÷ Postgres µÄÅäÖý׶ÎÉùÃ÷ÁË MULTIBYTE Ö§³Öºó²ÅÉúЧ¡£
 
SERVER_ENCODING

 
ÉèÖöà×Ö½Ú·þÎñÆ÷¶Ë±àÂ뷽ʽΪ£º
value
Õâ¸öÖµ±êʶ·þÎñÆ÷±àÂ룮
Õâ¸öÌØÐÔÖ»ÓÐÔÚ¶ÔÖÆ×÷ Postgres µÄÅäÖý׶ÎÉùÃ÷ÁË MULTIBYTE Ö§³Öºó²ÅÉúЧ¡£
 
CONSTRAINTS

 

 
 
 
 
 

SET CONSTRAINTS Ó°Ï쵱ǰÊÂÎñÔ¼Êø¼ÆËãµÄ±íÏÖ£®SET CONSTRAINTS£¬ÔÚ SQL3 ÀïÃæ¹æ·¶£¬ÓÐÈçÏÂÔÊÐíµÄ²ÎÊý£º

constraintlist

 
¶ººÅ·Ö¸ôµÄ¿ÉÍƳٵÄÔ¼ÊøÃûÁÐ±í£®
mode

 

 
 
 
 
 

Ô¼Êøģʽ£®ÔÊÐíÖµÊÇ DEFERRED ºÍ IMMEDIATE£®

ÔÚ IMMEDIATE ģʽ£¬Íâ¼üÔ¼ÊøÔÚÿ¸ö²éѯ½áÊøʱ¼ì²é£®

ÔÚ DEFERRED ģʽ£¬±ê¼ÇΪ DEFERRABLE µÄÍâ¼üÔ¼ÊøÖ»ÊÇÔÚÊÂÎñÌύʱ»òÕßÔ¼ÊøµÄģʽ±»ÏÔʽµØÉèΪ IMMEDIATE ʱ²Å¼ì²é£®Êµ¼ÊÉÏ£¬ÕâЩֻ¶ÔÍâ¼üÔ¼ÊøÆð×÷Óã¬Òò´ËËü²»Ó¦ÓÃÓÚ UNIQUE »òÕßÆäËûÔ¼Êø£®

TIME ZONE, TIMEZONE

 
ʱÇøµÄ¿ÉÄÜÖµÓëÄãµÄ²Ù×÷ϵͳÓйأ®ÀýÈç Linux µÄ/usr/lib/zoneinfo ÀïÃæ°üº¬Ê±ÇøµÄÊý¾Ý¿â£®

 

 
 
 
 
 
 
 

ÏÂÃæÊÇʱÇøµÄһЩÓÐЧֵ£®
PST8PDT
½«Ê±ÇøÉèΪ California £¨¼ÓÖÝ£©
Portugal
½«Ê±ÇøÉèΪ Portugal £¨ÆÏÌÑÑÀ£©£®
'Europe/Rome'
½«Ê±ÇøÉèΪ Italy £¨Òâ´óÀû£©£®
DEFAULT
½«Ê±ÇøÉèΪÄãµÄ±¾µØʱÇø£¨TZ »·¾³±äÁ¿µÄÖµ£©£®

Èç¹ûÉùÃ÷ÁËÒ»¸öÎÞЧʱÇø£¬Ê±Çø¾Í»á±ä³É GMT£¨ÔÚ´ó¶àÊýϵͳÉÏ£©£®

µÚ¶þÖÖÓï·¨ÔÚÉÏÃæÏÔʾ£¬ËüÔÊÐíÓû§ÓÃÒ»¸öÀàËÆÓÚ SQL92 SET TIME ZONE µÄÓï·¨ÉèÖÃʱÇø£®LOCAL ¹Ø¼ü×ÖÖ»ÊÇÓÃÓÚ SQL92 ¼æÈÝµÄ DEFAULT ¿ÉÑ¡µÄ¹Ø¼ü×Ö£®

Èç¹ûÒ»¸ö»ùÓÚ libpq µÄ¿Í»§¶ËµÄ»·¾³ÀïÉèÖÃÁË PGTZ£¬libpq ½«ÔÚÁª½ÓÆô¶¯Ê±×Ô¶¯°Ñ TIMEZONE ÉèÖóÉΪ PGTZ µÄÖµ¡£

TRANSACTION ISOLATION LEVEL
¸øµ±Ç°ÊÂÎñÉèÖøôÀ뼶±ð¡£
READ COMMITTED
µ±Ç°ÊÂÎñ²éѯ½«Ö»¶ÁÈ¡ÔÚ²éѯ֮ǰÌá½»µÄÊý¾Ý¡£READ COMMITTED ÊÇȱʡֵ¡£
×¢Ò⣺SQL92 ±ê×¼ÒªÇó SERIALIZABLE ΪȱʡµÄ¸ôÀ뼶±ð¡£
SERIALIZABLE
µ±Ç°µÄÊÂÎñ²éѯֻÄܶÁÈ¡ÔÚ¸ÃÊÂÎñÀïµÚÒ»¸ö DML Óï¾ä£¨SELECT/INSERT/DELETE/UPDATE/FETCH/COPY_TO£©Ö´ÐÐÇ°µÄÊý¾Ý¡£
»¹Óм¸¸ö¿ÉÒÔ SET ÃüÁîÉùÃ÷µÄÓÃÄÚ²¿µÄ»òÓÅ»¯µÄ²ÎÊý£º
PG_OPTIONS

ÉèÖø÷ÖÖºó¶Ë²ÎÊý£®
RANDOM_PAGE_COST

 
ÉèÖÃÓÅ»¯Æ÷¶Ô·ÇÁ¬Ðø´ÅÅÌÒ³Ãæ¶ÁÈ¡µÄ¿ªÏúµÄÔ¤¼ÆÖµ¡£ÕâÊÇÒÔÁ¬ÐøÒ³Ãæ¶ÁÈ¡µÄ¿ªÏúµÄ±¶Êý¼ÆËãµÄ¡£

 
float8

 
ÉèÖÃËæ»úÒ³Ãæ·ÃÎʵĿªÏúΪÉùÃ÷µÄ¸¡µãÖµ¡£
CPU_TUPLE_COST
ÉèÖÃÓÅ»¯Æ÷´¦Àí²éѯÀïÿÌõ¼Ç¼µÄ¿ªÏúµÄÔ¤¼ÆÖµ¡£ÕâÊÇÒÔÁ¬ÐøÒ³Ãæ¶ÁÈ¡µÄ¿ªÏúµÄ·ÖÊý½øÐмÆËãµÄ¡£

 
float8

 
°ÑÿÌõ¼Ç¼µÄ CPU ´¦ÀíµÄ¿ªÏúÉèÖÃÉùÃ÷µÄ¸¡µãÖµ¡£
CPU_INDEX_TUPLE_COST

ÉèÖÃÓÅ»¯Æ÷½øÐÐË÷ÒýɨÃèʱ´¦ÀíÿÌõË÷Òý¼Ç¼µÄ¿ªÏúµÄÔ¤¼ÆÖµ¡£ÕâÊÇÒÔÁ¬ÐøÒ³Ãæ¶ÁÈ¡µÄ¿ªÏúµÄ·ÖÊý½øÐмÆËãµÄ¡£
float8
°ÑÿÌõË÷Òý¼Ç¼µÄ CPU ´¦ÀíµÄ¿ªÏúÉèÖÃÉùÃ÷µÄ¸¡µãÖµ¡£
CPU_OPERATOR_COST

ÉèÖÃÓÅ»¯Æ÷´¦Àí WHERE ×Ó¾äÀïÿ¸ö²Ù×÷·ûµÄ¿ªÏúµÄÔ¤¼ÆÖµ¡£ÕâÊÇÒÔÁ¬ÐøÒ³Ãæ¶ÁÈ¡µÄ¿ªÏúµÄ·ÖÊý½øÐмÆËãµÄ¡£
float8
°Ñÿ¸ö²Ù×÷·ûµÄ CPU ´¦ÀíµÄ¿ªÏúÉèÖÃÉùÃ÷µÄ¸¡µãÖµ¡£
EFFECTIVE_CACHE_SIZE

ÉèÖÃÓÅ»¯Æ÷¶Ô´ÅÅÌ»º³åÓÐЧ³ß´çµÄ¼ÙÉ裨Ҳ¾ÍÊÇ˵£¬½«±» Postgres Êý¾ÝÎļþʹÓõÄÄں˵ĴÅÅÌ»º³åµÄ²¿·Ö£©¡£ÕâÊÇÒÔ´ÅÅÌÒ³Ãæ¼ÆÁ¿µÄ£¬Í¨³£Ã¿¿é 8Kb¡£
float8
°Ñÿ¸ö²Ù×÷·ûµÄ CPU ´¦ÀíµÄ¿ªÏúÉèÖÃÉùÃ÷µÄ¸¡µãÖµ¡£
ENABLE_SEQSCAN
ÔÊÐí»òÕß½ûÖ¹¹æ»®Æ÷¶Ô˳ÐòɨÃè¹æ»®ÀàÐ͵ÄʹÓᣣ¨ÍêÈ«½ûֹ˳ÐòɨÃèÊDz»¿ÉÄܵģ¬µ«ÊÇ°ÑÕâ¸ö±äÁ¿ÖÃΪ OFF ½«µ¼Ö¹滮Æ÷ÔÚ´æÔÚÆäËû¿ÉÓ÷½·¨µÄÇé¿öϲ»²ÉÓÃ˳ÐòɨÃè¡££©
ON
ÔÊÐíʹÓÃ˳ÐòɨÃ裨ȱʡÉèÖã©¡£
OFF
½ûֹʹÓÃ˳ÐòɨÃè¡£
ENABLE_INDEXSCAN
ÔÊÐí»òÕß½ûÖ¹¹æ»®Æ÷¶ÔË÷ÒýɨÃè¹æ»®ÀàÐ͵ÄʹÓá£
ON
ÔÊÐíʹÓÃË÷ÒýɨÃ裨ȱʡÉèÖã©¡£
OFF
½ûֹʹÓÃË÷ÒýɨÃè¡£
ENABLE_TIDSCAN
ÔÊÐí»òÕß½ûÖ¹¹æ»®Æ÷¶Ô TID ɨÃè¹æ»®ÀàÐ͵ÄʹÓá£
ON
ÔÊÐíʹÓà TID ɨÃ裨ȱʡÉèÖã©¡£
OFF
½ûֹʹÓà TID ɨÃè¡£
ENABLE_SORT
ÔÊÐí»òÕß½ûÖ¹¹æ»®Æ÷¶ÔÏÔʽÅÅÐò²½ÖèµÄʹÓᣣ¨ÍêÈ«½ûÖ¹ÏÔʽÅÅÐò²½ÖèÊDz»¿ÉÄܵģ¬µ«ÊÇ°ÑÕâ¸ö±äÁ¿ÖÃΪ OFF ½«µ¼Ö¹滮Æ÷ÔÚ´æÔÚÆäËû¿ÉÓ÷½·¨µÄÇé¿öϲ»²ÉÓÃÏÔʽÅÅÐò²½Öè¡££©
ON
ÔÊÐíʹÓÃÅÅÐò£¨È±Ê¡ÉèÖã©¡£
OFF
½ûֹʹÓÃÅÅÐò¡£
ENABLE_NESTLOOP
ÔÊÐí»òÕß½ûÖ¹¹æ»®Æ÷¶ÔǶÌ×Ñ­»·ÁªºÏ¹æ»®µÄʹÓᣣ¨ÍêÈ«½ûֹǶÌ×Ñ­»·ÁªºÏÊDz»¿ÉÄܵģ¬µ«ÊÇ°ÑÕâ¸ö±äÁ¿ÖÃΪ OFF ½«µ¼Ö¹滮Æ÷ÔÚ´æÔÚÆäËû¿ÉÓ÷½·¨µÄÇé¿öϲ»²ÉÓÃǶÌ×Ñ­»·¹æ»®¡££©
ON
ÔÊÐíʹÓÃǶÌ×Ñ­»·ÁªºÏ£¨È±Ê¡ÉèÖã©¡£
OFF
½ûֹʹÓÃǶÌ×Ñ­»·ÁªºÏ¡£
ENABLE_MERGEJOIN
´ò¿ª»òÕ߹رչ滮Æ÷¶ÔÈںϣ¨merge join£©ÁªºÏ¹æ»®µÄʹÓá£
ON
ÔÊÐíʹÓÃÈںϣ¨merge join£©ÁªºÏ£¨È±Ê¡ÉèÖã©¡£
OFF
½ûֹʹÓÃÈںϣ¨merge join£©ÁªºÏ¡£
ENABLE_HASHJOIN
´ò¿ª»òÕ߹رչ滮Æ÷¶Ô¹þÏ££¨É¢ÁУ©¹æ»®µÄʹÓá£
ON
ÔÊÐíʹÓùþÏ££¨É¢ÁУ©ÁªºÏ£¨È±Ê¡ÉèÖã©¡£
OFF
½ûֹʹÓùþÏ££¨É¢ÁУ©ÁªºÏ¡£
GEQO
ΪʹÓûùÒòÓÅ»¯Æ÷Ëã·¨ÉèÖÃãÐÖµ£®
ON
ÔÊÐí»ùÒòÓÅ»¯Æ÷Ëã·¨ÓÅ»¯´øÓÐ11¸ö»ò11¸öÒÔÉϱíµÄÓï¾ä£®£¨ÕâÒ²ÊÇȱʡÉèÖã©

 
ON=#
´øÒ»¸öÕûÊý²ÎÊý£¬ÔÊÐíÓÅ»¯Æ÷ÓÅ»¯´øÓÐ # »ò¸ü¶àµÄ±íµÄ²éѯ£®

 
OFF
½ûÓûùÒòÓÅ»¯Æ÷£®

Çë²Î¿¼³ÌÐòÔ±ÊÖ²áÖйØÓÚ GEQO µÄÕ½ڻñÈ¡¹ØÓÚ²éѯÓÅ»¯µÄ¸ü¶àÐÅÏ¢¡£

Èç¹ûÒ»¸ö»ùÓÚ libpq µÄ¿Í»§¶ËµÄ»·¾³ÀïÉèÖÃÁË PGGEQO »·¾³±äÁ¿£¬libpq ½«ÔÚÁª½ÓÆô¶¯Ê±×Ô¶¯°Ñ GEQO ÉèÖóÉΪ PGGEQO µÄÖµ¡£

KSQO
Key Set Query Optimizer £¨¼ü¼¯²éѯÓÅ»¯£©µ¼Ö²éѯ¹æ»®Æ÷°Ñ WHERE ×Ó¾ä´øÓÐÐí¶à OR Á赀 AND ×Ó¾äµÄ²éѯ£¨Ïó "WHERE (a=1 AND b=2) OR (a=2 AND b=3) ..."£©×ª»»³ÉÒ»¸öUNION ²éѯ¡£Õâ¸ö·½·¨¿ÉÒÔ±ÈȱʡµÄʵÏÖ¸ü¿ì£¬µ«ÊÇËü²»Ò»¶¨µÃ³öÏàͬµÄ½á¹û£¬ÒòΪ UNION Òþº¬µÄ¼ÓÁËÒ»Ìõ SELECT DISTINCT ×Ó¾äÒÔÏû³ýÏàͬµÄÐС£KSQO ³£ÓÃÓں͠MicroSoft Access ÕâÑùµÄ¶«Î÷²¢Óã¬ËüÈÝÒ×Éú³ÉÕâÖÖÀàÐ͵IJéѯ¡£
ON
´ò¿ªÓÅ»¯¡£
OFF
¹Ø±ÕÓÅ»¯£¨È±Ê¡ÉèÖã©¡£
DEFAULT
µÈЧÓÚÉùÃ÷ SET KSQO='OFF'¡£

KSQO Ëã·¨¶Ô´øÓÐÐí¶à OR Á赀 AND ×Ó¾äµÄ²éѯÊǷdz£±ØÒªµÄ£¬²»¹ýÔÚ Postgres 7.0 ºÍÒÔºóµÄ°æ±¾À±ê×¼µÄ¹æ»®Æ÷¿ÉÒԺܺõIJÙ×÷ÕâЩ²éѯ¡£
MAX_EXPR_DEPTH

ÉèÖ÷ÖÎöÆ÷¿É½ÓÊܵÄ×î´ó±í´ïʽǶÌ×Éî¶È£®È±Ê¡Öµ¶ÔÈκγ£¼û²éѯ¶¼×ã¹»¸ßÁË£¬µ«ÊÇÄã¿ÉÒÔ¸ù¾ÝÐèÒªÌá¸ßËü£®£¨²»¹ýÈç¹ûÄãÉýµÃÌ«¸ß£¬Äã¾Í»áðÒòΪ¶ÑÕ»Òç³ö¶øµ¼Öºó¶Ë±ÀÀ£µÄΣÏÕ£®£©
integer

×î´óÉî¶È£®

Êä³ö

SET VARIABLE
³É¹¦µÄ·µ»ØÐÅÏ¢£®
WARN: Bad value for variable (value)
Èç¹ûÃüÁîÉèÖñäÁ¿Ê§°Ü£®·µ»Ø´ËÐÅÏ¢£®

ÃèÊö

SET ½«ÔÚÒ»¸ö»á»°¹ý³ÌÖÐΪ±äÁ¿ÐÞ¸ÄÅäÖòÎÊý£®

µ±Ç°Öµ¿ÉÒÔʹÓà SHOW »ñµÃ£¬¶øÇÒ¿ÉÒÔʹÓà RESET ÃüÁ¸÷¸öÖµÉè»Øȱʡ£®²ÎÊýºÍÖµ¶¼ÊÇ´óСдÎ޹صģ®×¢Òâ²ÎÊýÖµ×ÜÊÇÓÃ×Ö·û´®À´±í´ï£¬ËùÒÔÓõ¥ÒýºÅÀ¨ÆðÀ´£®

SET TIME ZONE ¸Ä±ä»á»°µÄȱʡʱÇøÆ«ÒÆÁ¿£®Ò»¸ö SQL£­»á»°×ÜÊÇÒÔȱʡµÄʱÇøÆ«ÒÆ×÷Ϊ³õʼֵ£® SET TIME ZONE Óï¾äÓÃÓڸı䵱ǰµÄ SQL »á»°µÄȱʡʱÇøÆ«ÒÆÁ¿£®

×¢Òâ

SET variable Óï¾äÊÇ Postgres ÓïÑÔµÄÀ©Õ¹£®
Çë²Î¿¼ SHOW ºÍ RESET ÃüÁîÏÔʾ»òÖØÖõ±Ç°Öµ£®

Ó÷¨

ÉèÖÃʱÇø·ç¸ñΪ ISO£¨²ÎÊý²»ÐèÒªÒýºÅ£©£º
SET DATESTYLE TO ISO;
¶Ô4¸ö»ò¸ü¶à±íµÄ²éѯ£¬Ê¹ GEQO ÉúЧ£¨Çë×¢ÒâÕâÀïÓõ¥ÒýºÅ²Ù×÷²ÎÊýÖµÀïÃæµÄµÈºÅ£©£º
 
SET GEQO = 'ON=4';
ÉèÖà GEQO Ϊȱʡֵ£º
 
SET GEQO = DEFAULT;
°ÑʱÇøÉèÖÃΪ Berkeley, California£¬Ê¹ÓÃË«ÒýºÃ±£´æʱÇøÉùÃ÷Àï´óд×Ö·ûµÄÊôÐÔ£º
 
SET TIME ZONE "PST8PDT";
SELECT CURRENT_TIMESTAMP AS today;
   
         today
------------------------
 1998-03-31 07:41:21-08
ÉèÖÃʱÇøΪ Italy£¨×¢ÒâÕâÀïÒªÇóµÄµ¥»òÕßË«ÒýºÅÀ´²Ù×÷ÌØÊâµÄ×Ö·û£©£º
 
SET TIME ZONE 'Europe/Rome';
SELECT CURRENT_TIMESTAMP AS today;
   
         today
------------------------
 1998-03-31 17:41:31+02

¼æÈÝÐÔ

SQL92

ÔÚ SQL92 ÀïûÓÐ SET variable Óï¾ä£¨³ýÁË SET TRANSACTION ISOLATION LEVEL£©¡£SQL92 ÓÃÓÚ SET TIME ZONE µÄÓï·¨ÓÐÒ»µãµã²»Í¬£¬Ö»ÔÊÐíΪʱÇøÉùÃ÷Ò»¸öÕûÊýÖµ£º
SET TIME ZONE { interval_value_expression | LOCAL }
Ê