Re: ENABLE/DISABLE CONSTRAINT NAME

From: wangshuo(at)highgo(dot)com(dot)cn
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Subject: Re: ENABLE/DISABLE CONSTRAINT NAME
Date: 2013-09-01 14:27:26
Message-ID: 8b427d729107f474038a6f6908aef82a@highgo.com.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

于 2013-08-30 21:27, Tom Lane 回复:
> wangshuo(at)highgo(dot)com(dot)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(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2013-09-01 14:36:19 Re: CREATE FUNCTION .. SET vs. pg_dump
Previous Message Andres Freund 2013-09-01 14:06:27 Re: [v9.4] row level security