set_constraints.7

来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· 7 代码 · 共 63 行

7
63
字号
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $.TH "SET CONSTRAINTS" "" "2008-01-03" "SQL - Language Statements" "SQL Commands".SH NAMESET CONSTRAINTS \- set constraint checking modes for the current transaction.SH SYNOPSIS.sp.nfSET CONSTRAINTS { ALL | \fIname\fR [, ...] } { DEFERRED | IMMEDIATE }.sp.fi.SH "DESCRIPTION".PP\fBSET CONSTRAINTS\fR sets the behavior of constraintchecking within the current transaction. IMMEDIATEconstraints are checked at the end of eachstatement. DEFERRED constraints are not checked untiltransaction commit. Each constraint has its ownIMMEDIATE or DEFERRED mode..PPUpon creation, a constraint is given one of threecharacteristics: DEFERRABLE INITIALLY DEFERRED,DEFERRABLE INITIALLY IMMEDIATE, orNOT DEFERRABLE. The thirdclass is always IMMEDIATE and is not affected by the\fBSET CONSTRAINTS\fR command. The first two classes startevery transaction in the indicated mode, but their behavior can be changedwithin a transaction by \fBSET CONSTRAINTS\fR..PP\fBSET CONSTRAINTS\fR with a list of constraint names changesthe mode of just those constraints (which must all be deferrable). Thecurrent schema search path is used to find the first matching name ifno schema name is specified. \fBSET CONSTRAINTS ALL\fR changes the mode of all deferrable constraints..PPWhen \fBSET CONSTRAINTS\fR changes the mode of a constraintfrom DEFERREDto IMMEDIATE, the new mode takes effectretroactively: any outstanding data modifications that would havebeen checked at the end of the transaction are instead checked during theexecution of the \fBSET CONSTRAINTS\fR command.If any such constraint is violated, the \fBSET CONSTRAINTS\fRfails (and does not change the constraint mode). Thus, \fBSETCONSTRAINTS\fR can be used to force checking of constraints tooccur at a specific point in a transaction..PPCurrently, only foreign key constraints are affected by thissetting. Check and unique constraints are always effectivelynot deferrable..SH "NOTES".PPThis command only alters the behavior of constraints within thecurrent transaction. Thus, if you execute this command outside of atransaction block(\fBBEGIN\fR/\fBCOMMIT\fR pair), it willnot appear to have any effect..SH "COMPATIBILITY".PPThis command complies with the behavior defined in the SQLstandard, except for the limitation that, inPostgreSQL, it only applies toforeign-key constraints.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?