于 2013-08-30 21:27, Tom Lane 回复:
> wangshuo@highgo.com.cn writes:
>> In order to achieve enable/disable constraint name,I made a
>> few
>> modifications to the code.
>> First, someone used to build the constraints while building
>> table. Then inserting data must follow a certain order.
>> And people usually like to insert the data but not affected
>> by
>> foreign keys or check.
>> Second, the check or the foreign key constraint will waste
>> much
>> time while inserting the data into the table.
>> Due to the above reasons,I realized this command.
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Uh ... why not just drop the constraint, and re-add it later if you
> want
> it again?
Thanks for your reply.
If you drop the constraint,you must record the sql of the constraint.
ENABLE/DISABLE just turn off or trun on that.The sql2008 support this.
And, Oracle,DB2,SQL Server,MySQL all support this feature, new users
ever used Oracle are accustomed to
use, besides, this feature benefits data migration, so we have enough
reasons to
add this feature.
> This seems like adding a lot of mechanism (and possible bugs)
> for a rather marginal use-case.
>
> regards, tom lane
I changed the pg_constraint system table , the ConstrCheck struct, the
CreateTrigger function, the CreateConstraintEntry function and some
grammars.
I have passed the pgtest,and this may has some bugs.
I refer to the validation feature to do this feature.
The validation feature only works while adding constraint,
my work is a supplement to the validation feature.
If possible, I would like to merge the two features together.
For all above, I wrote this letter to community, to let more people to
talk about
this and correct possible bugs.
Wang Shuo HighGo Software Co.,Ltd. September 1, 2013