Thread: how can i drop a constraint

how can i drop a constraint

From
rute solipa
Date:
hello,

i've got some tables where constraints don't have an explicit name, how can 
i drop them.

best regards,

rute



Re: how can i drop a constraint

From
Christoph Haller
Date:
>
> i've got some tables where constraints don't have an explicit name,
how can
> i drop them.
>

Refer to the system catalogs section within the documentation.
pg_relcheck keeps track of constraints.

Regards, Christoph




Re: how can i drop a constraint

From
Christoph Haller
Date:
>
> >
> > i've got some tables where constraints don't have an explicit name,
> how can
> > i drop them.
> >
>
> Refer to the system catalogs section within the documentation.
> pg_relcheck keeps track of constraints.
>
>
More precisely

select relname , rcname from pg_class join pg_relcheck on (
pg_relcheck.rcrelid = pg_class.oid ) ;

Regards, Christoph




Re: how can i drop a constraint

From
Christoph Haller
Date:
>
> but with this query i only get the name from constraints type check ,
i
> need to get the names of all constraints types.

Not sure what exactly do you mean by this.
Have you done a SELECT * FROM pg_relcheck ;
to see what's all in there? Maybe an example would help.
>
> by the way, how can i disable constraints.

Within ALTER TABLE you can DROP constraints, I don't know if
there is a feature to temporarily disable constraints.
>
You should post to the list too. I'm not the expert on constraints.

Regards, Christoph

>
> At 04:23 PM 2/25/2003 +0100, you wrote:
> > >
> > > >
> > > > i've got some tables where constraints don't have an explicit
name,
> > > how can
> > > > i drop them.
> > > >
> > >
> > > Refer to the system catalogs section within the documentation.
> > > pg_relcheck keeps track of constraints.
> > >
> > >
> >More precisely
> >
> >select relname , rcname from pg_class join pg_relcheck on (
> >pg_relcheck.rcrelid = pg_class.oid ) ;
> >