pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feeddisable constraints
5+ messages / 4 participants
[nested] [flat]
* disable constraints
@ 2003-02-26 14:38 rute solipa <rutes@eselx.ipl.pt>
2003-02-26 14:47 ` Re: disable constraints Patrik Kudo <kudo@pingpong.net>
2003-02-26 16:50 ` Re: disable constraints rute solipa <rutes@eselx.ipl.pt>
0 siblings, 2 replies; 5+ messages in thread
From: rute solipa @ 2003-02-26 14:38 UTC (permalink / raw)
To: pgsql-sql
hello,
does anyone nows how can i disable/enable table or column constraints?
in oracle it's possible to disable constraints like this:
alter table tb_1
disable primary key;
best regards,
rute
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: disable constraints
2003-02-26 14:38 disable constraints rute solipa <rutes@eselx.ipl.pt>
@ 2003-02-26 14:47 ` Patrik Kudo <kudo@pingpong.net>
1 sibling, 0 replies; 5+ messages in thread
From: Patrik Kudo @ 2003-02-26 14:47 UTC (permalink / raw)
To: rute solipa <rutes@eselx.ipl.pt>; +Cc: pgsql-sql
Hi!
use "alter table ??? drop constraint ???"
example:
create table asdf (userid text, foreign key (userid) references
person(userid) on delete cascade);
\d asdf
Table "public.asdf"
Column | Type | Modifiers
--------+------+-----------
userid | text |
Foreign Key constraints: $1 FOREIGN KEY (userid) REFERENCES
person(userid) ON UPDATE NO ACTION ON DELETE CASCADE
alter table asdf drop constraint "$1";
Regards,
Patrik Kudo
rute solipa wrote:
> hello,
>
> does anyone nows how can i disable/enable table or column constraints?
>
> in oracle it's possible to disable constraints like this:
>
> alter table tb_1
> disable primary key;
>
> best regards,
> rute
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: disable constraints
2003-02-26 14:38 disable constraints rute solipa <rutes@eselx.ipl.pt>
@ 2003-02-26 16:50 ` rute solipa <rutes@eselx.ipl.pt>
2003-02-28 22:42 ` Re: disable constraints Dmitry Tkach <dmitry@openratings.com>
2003-03-07 01:31 ` Re: disable constraints Bruce Momjian <pgman@candle.pha.pa.us>
1 sibling, 2 replies; 5+ messages in thread
From: rute solipa @ 2003-02-26 16:50 UTC (permalink / raw)
To: pgsql-sql; kudo@pingpong.net
i whant avoid to dropping constraint, i whant to disable the constraints,
because i need to insert a large amont of data.
is there a way?
best regards,
rute
At 03:47 PM 2/26/2003 +0100, you wrote:
>Hi!
>
>use "alter table ??? drop constraint ???"
>
>example:
>
>create table asdf (userid text, foreign key (userid) references
>person(userid) on delete cascade);
>
>\d asdf
> Table "public.asdf"
> Column | Type | Modifiers
>--------+------+-----------
> userid | text |
>Foreign Key constraints: $1 FOREIGN KEY (userid) REFERENCES person(userid)
>ON UPDATE NO ACTION ON DELETE CASCADE
>
>alter table asdf drop constraint "$1";
>
>Regards,
>Patrik Kudo
>
>rute solipa wrote:
>>hello,
>>does anyone nows how can i disable/enable table or column constraints?
>>in oracle it's possible to disable constraints like this:
>>alter table tb_1
>>disable primary key;
>>best regards,
>>rute
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 3: if posting/reading through Usenet, please send an appropriate
>>subscribe-nomail command to majordomo@postgresql.org so that your
>>message can get through to the mailing list cleanly
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: disable constraints
2003-02-26 14:38 disable constraints rute solipa <rutes@eselx.ipl.pt>
2003-02-26 16:50 ` Re: disable constraints rute solipa <rutes@eselx.ipl.pt>
@ 2003-02-28 22:42 ` Dmitry Tkach <dmitry@openratings.com>
1 sibling, 0 replies; 5+ messages in thread
From: Dmitry Tkach @ 2003-02-28 22:42 UTC (permalink / raw)
To: rute solipa <rutes@eselx.ipl.pt>
rute solipa wrote:
> i whant avoid to dropping constraint, i whant to disable the constraints,
> because i need to insert a large amont of data.
> is there a way?
>
> best regards,
> rute
>
>
There is no "oficial" way to do that, as far as I know...
You can disable *triggers* on a table (which will disable all the FK constraints, but not things like 'not nul' or 'unique'), by doing:
update pg_class set reltriggers=0 where relname = 'YOUR_TABLE_NAME';
to enable them after you are done, do
update pg_class set reltriggers = count(*) from pg_trigger where pg_class.oid=tgrelid and relname='YOUR_TABLE_NAME';
I hope, it helps...
Dima
>
> At 03:47 PM 2/26/2003 +0100, you wrote:
>
>>Hi!
>>
>>use "alter table ??? drop constraint ???"
>>
>>example:
>>
>>create table asdf (userid text, foreign key (userid) references
>>person(userid) on delete cascade);
>>
>>\d asdf
>> Table "public.asdf"
>> Column | Type | Modifiers
>>--------+------+-----------
>> userid | text |
>>Foreign Key constraints: $1 FOREIGN KEY (userid) REFERENCES person(userid)
>>ON UPDATE NO ACTION ON DELETE CASCADE
>>
>>alter table asdf drop constraint "$1";
>>
>>Regards,
>>Patrik Kudo
>>
>>rute solipa wrote:
>>
>>>hello,
>>>does anyone nows how can i disable/enable table or column constraints?
>>>in oracle it's possible to disable constraints like this:
>>>alter table tb_1
>>>disable primary key;
>>>best regards,
>>>rute
>>>
>>>---------------------------(end of broadcast)---------------------------
>>>TIP 3: if posting/reading through Usenet, please send an appropriate
>>>subscribe-nomail command to majordomo@postgresql.org so that your
>>>message can get through to the mailing list cleanly
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: disable constraints
2003-02-26 14:38 disable constraints rute solipa <rutes@eselx.ipl.pt>
2003-02-26 16:50 ` Re: disable constraints rute solipa <rutes@eselx.ipl.pt>
@ 2003-03-07 01:31 ` Bruce Momjian <pgman@candle.pha.pa.us>
1 sibling, 0 replies; 5+ messages in thread
From: Bruce Momjian @ 2003-03-07 01:31 UTC (permalink / raw)
To: rute solipa <rutes@eselx.ipl.pt>; +Cc: pgsql-sql; kudo@pingpong.net
TODO has:
* Allow triggers to be disabled [trigger]
and referential constraints are implemented using triggers, so no, we
don't have that functionality yet.
---------------------------------------------------------------------------
rute solipa wrote:
> i whant avoid to dropping constraint, i whant to disable the constraints,
> because i need to insert a large amont of data.
> is there a way?
>
> best regards,
> rute
>
>
>
> At 03:47 PM 2/26/2003 +0100, you wrote:
> >Hi!
> >
> >use "alter table ??? drop constraint ???"
> >
> >example:
> >
> >create table asdf (userid text, foreign key (userid) references
> >person(userid) on delete cascade);
> >
> >\d asdf
> > Table "public.asdf"
> > Column | Type | Modifiers
> >--------+------+-----------
> > userid | text |
> >Foreign Key constraints: $1 FOREIGN KEY (userid) REFERENCES person(userid)
> >ON UPDATE NO ACTION ON DELETE CASCADE
> >
> >alter table asdf drop constraint "$1";
> >
> >Regards,
> >Patrik Kudo
> >
> >rute solipa wrote:
> >>hello,
> >>does anyone nows how can i disable/enable table or column constraints?
> >>in oracle it's possible to disable constraints like this:
> >>alter table tb_1
> >>disable primary key;
> >>best regards,
> >>rute
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 3: if posting/reading through Usenet, please send an appropriate
> >>subscribe-nomail command to majordomo@postgresql.org so that your
> >>message can get through to the mailing list cleanly
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2003-03-07 01:31 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-26 14:38 disable constraints rute solipa <rutes@eselx.ipl.pt>
2003-02-26 14:47 ` Patrik Kudo <kudo@pingpong.net>
2003-02-26 16:50 ` rute solipa <rutes@eselx.ipl.pt>
2003-02-28 22:42 ` Dmitry Tkach <dmitry@openratings.com>
2003-03-07 01:31 ` Bruce Momjian <pgman@candle.pha.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox