alter_domain.7
来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· 7 代码 · 共 145 行
7
145 行
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $.TH "ALTER DOMAIN" "" "2008-01-03" "SQL - Language Statements" "SQL Commands".SH NAMEALTER DOMAIN \- change the definition of a domain.SH SYNOPSIS.sp.nfALTER DOMAIN \fIname\fR { SET DEFAULT \fIexpression\fR | DROP DEFAULT }ALTER DOMAIN \fIname\fR { SET | DROP } NOT NULLALTER DOMAIN \fIname\fR ADD \fIdomain_constraint\fRALTER DOMAIN \fIname\fR DROP CONSTRAINT \fIconstraint_name\fR [ RESTRICT | CASCADE ]ALTER DOMAIN \fIname\fR OWNER TO \fInew_owner\fR ALTER DOMAIN \fIname\fR SET SCHEMA \fInew_schema\fR .sp.fi.SH "DESCRIPTION".PP\fBALTER DOMAIN\fR changes the definition of an existing domain.There are several sub-forms:.TP\fBSET/DROP DEFAULT\fRThese forms set or remove the default value for a domain. Notethat defaults only apply to subsequent \fBINSERT\fRcommands; they do not affect rows already in a table using the domain..TP\fBSET/DROP NOT NULL\fRThese forms change whether a domain is marked to allow NULLvalues or to reject NULL values. You may only SET NOT NULLwhen the columns using the domain contain no null values..TP\fBADD \fIdomain_constraint\fB\fRThis form adds a new constraint to a domain using the same syntax asCREATE DOMAIN [\fBcreate_domain\fR(7)].This will only succeed if all columns using the domain satisfy thenew constraint..TP\fBDROP CONSTRAINT\fRThis form drops constraints on a domain..TP\fBOWNER\fRThis form changes the owner of the domain to the specified user..TP\fBSET SCHEMA\fRThis form changes the schema of the domain. Any constraintsassociated with the domain are moved into the new schema as well..PPYou must own the domain to use \fBALTER DOMAIN\fR.To change the schema of a domain, you must also haveCREATE privilege on the new schema.To alter the owner, you must also be a direct or indirect member of the newowning role, and that role must have CREATE privilege onthe domain's schema. (These restrictions enforce that altering the ownerdoesn't do anything you couldn't do by dropping and recreating the domain.However, a superuser can alter ownership of any domain anyway.).PP.SH "PARAMETERS".PP.TP\fB\fIname\fB\fRThe name (possibly schema-qualified) of an existing domain toalter..TP\fB\fIdomain_constraint\fB\fRNew domain constraint for the domain..TP\fB\fIconstraint_name\fB\fRName of an existing constraint to drop..TP\fBCASCADE\fRAutomatically drop objects that depend on the constraint..TP\fBRESTRICT\fRRefuse to drop the constraint if there are any dependentobjects. This is the default behavior..TP\fB\fInew_owner\fB\fRThe user name of the new owner of the domain..TP\fB\fInew_schema\fB\fRThe new schema for the domain..PP.SH "NOTES".PPCurrently, \fBALTER DOMAIN ADD CONSTRAINT\fR and\fBALTER DOMAIN SET NOT NULL\fR will fail if the named domain orany derived domain is used within a composite-type column of anytable in the database. They should eventually be improved to beable to verify the new constraint for such nested columns..SH "EXAMPLES".PPTo add a NOT NULL constraint to a domain:.sp.nfALTER DOMAIN zipcode SET NOT NULL; .sp.fiTo remove a NOT NULL constraint from a domain:.sp.nfALTER DOMAIN zipcode DROP NOT NULL; .sp.fi.PPTo add a check constraint to a domain:.sp.nfALTER DOMAIN zipcode ADD CONSTRAINT zipchk CHECK (char_length(VALUE) = 5); .sp.fi.PPTo remove a check constraint from a domain:.sp.nfALTER DOMAIN zipcode DROP CONSTRAINT zipchk; .sp.fi.PPTo move the domain into a different schema:.sp.nfALTER DOMAIN zipcode SET SCHEMA customers; .sp.fi.SH "COMPATIBILITY".PP\fBALTER DOMAIN\fR conforms to the SQLstandard,except for the OWNER and SET SCHEMA variants,which are PostgreSQL extensions..SH "SEE ALSO"CREATE DOMAIN [\fBcreate_domain\fR(7)], DROP DOMAIN [\fBdrop_domain\fR(l)]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?