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

ALTER DOMAIN

劉䓄

ALTER DOMAIN  -- 媞櫹婔婻嘘䔇垔幬

臺濘

ALTER DOMAIN name
    { SET DEFAULT expression | DROP DEFAULT }
ALTER DOMAIN name
    { SET | DROP } NOT NULL
ALTER DOMAIN name
    ADD domain_constraint
ALTER DOMAIN name
    DROP CONSTRAINT constraint_name [ RESTRICT | CASCADE ]
ALTER DOMAIN name
    OWNER TO new_owner 
ALTER DOMAIN name
    SET SCHEMA new_schema 
  

柟誄

ALTER DOMAIN 媞櫹婔婻䯄橬嘘䔇垔幬㔗垄橬庹䓉床嘵嚟

SET/DROP DEFAULT

認底嘵嚟螆䘞潡蔙役鍴婔婻嘘䔇䚺䩕唚㔗臙濘懟䚺䩕唚埻锗䫘庯锟劯䔇 INSERT 变傴傡傸幽婉嘌巉嘪䫘臖嘘䔇噾䂟婘臘婺䔇臯㔗

SET/DROP NOT NULL

認底嘵嚟櫹埻婔婻嘘滇劥湺螄婺噕螩 NULL 唚潡蔙滇拐䂺 NULL 唚㔗婘嘪䫘嘘䔇庖枕寙劆麂 NULL 唚䔇施唍嘹埻埇傖 SET NOT NULL

ADD domain_constraint

認䓉嘵嚟嘪䫘启 CREATE DOMAIN 婔湙䔇臺濘劏嘘婺嵂媹婔䓉桄䔇亥溘㔗認湙啔埻橬婘欔橬嘪䫘嘘䔇庖枕悇轿桄亥溘䔇溇傽婋欉脘潊媘㔗

DROP CONSTRAINT

認䓉嘵嚟役鍴婔婻嘘婪䔇亥溘㔗

OWNER

認䓉嘵嚟檪嘘䔇欔橬蔙櫹埻婺埥崡婔婻䫘潙㔗

SET SCHEMA

認婻嘵嚟櫹埻嘘䔇昇嚟㔗傂嘘婯臖嘘䕩噿䔇亥溘鄘䓂媘彄桄䔇昇嚟麯㔗

襕嘪䫘 ALTER DOMAIN 嘹媙釂拖橬臖嘘㔗襕媞櫹婔婻嘘䔇昇嚟嘹誻媙釂婘桄昇嚟婪拖橬 CREATE 溄鍊㔗襕媞櫹欔橬蔙嘹誻媙釂滇桄䔇欔橬蓐謾䔇䕘毖潡閘毖潊叻幽婫臖潊叻媙釂婘溴嘘䔇昇嚟婪橬 CREATE 溄鍊㔗認底鍊彽嚺彽庖媞櫹臖欔橬蔙婉嚔啔傂嘘锔誺役鍴启麉傺嘘婉脘啔䔇庋愙㔗婉誺轙亓䫘潙埇傖傖傂嘘桹嚟媞櫹傂懟嘘䔇欔橬溄㔗

埗昄

name

婔婻襕媞櫹䔇䯄橬嘘䔇劉庖(埇傖橬昇嚟媞閄)

domain_constraint

嘘䔇桄嘘亥溘

constraint_name

襕役鍴䔇斓橬亥溘

CASCADE

亓蕫役鍴冺蕡認婻凹茇䔇亥溘

RESTRICT

套悩橬傂嘘冺蕡凹茇彍拐䂺役鍴亥溘㔗認滇䚺䩕臯婺㔗

new_owner

嘘䔇桄欔橬蔙䔇䫘潙劉

new_schema

嘘䔇桄昇嚟

冋床

䂍婔婻嘘嵂媹婔婻 NOT NULL 亥溘

ALTER DOMAIN zipcode SET NOT NULL;
   

傯婔婻嘘麯役鍴婔婻 NOT NULL 亥溘

ALTER DOMAIN zipcode DROP NOT NULL;
   

劏婔婻嘘麯嵂媹婔婻演昖亥溘

ALTER DOMAIN zipcode ADD CONSTRAINT zipchk CHECK (char_length(VALUE) = 5);
   

傯婔婻嘘麯役鍴婔婻演昖亥溘

ALTER DOMAIN zipcode DROP CONSTRAINT zipchk;
   

檪嘘䓂媘彄埥崡婔婻昇嚟

ALTER DOMAIN zipcode SET SCHEMA customers;
   

噚垹攓

OWNERSET SCHEMA 埻䓉(PostgreSQL 䔇欷匘)幋崡ALTER DOMAIN 臺埖婯 SQL 湺庖噚垹㔗

埽蓕

CREATE DOMAIN, DROP DOMAIN

劯锔饡釕嬉誕
ALTER DATABASE婪婔亓ALTER FUNCTION