From: | mlw <markw(at)mohawksoft(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Removing a constraint? |
Date: | 2001-01-03 16:43:20 |
Message-ID: | 3A5356A8.2568E6F6@mohawksoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-sql |
Michael Davis wrote:
> Does anyone know how to completely and accurately remove or drop a
> constraint, specifically a foreign key constraint? I tried to remove a
> constraint by deleting it's trigger from pg_triggers. This caused some
> undesirable side effects with other tables involved with the constraint. I
> have several tables that I need to change the column constraints and
> foreign key constraints on. Recreating (drop and create) the table every
> time I need to change a column constraint is a pain because all the objects
> that reference the table would also need to be recreated (i.e. views and
> triggers). How do production DBAs successfully make changes to their
> tables?
>
> FYI, I was able to alter table add the same constraint many times. Is this
> a problem? This created a new trigger in pg_triggers every time.
A bug in "cluster" will do this, if you cluster a table it will drop all
constraints and indexes.
One could use pg_dump, as:
pg_dump -a -t table database > table_data.sql
pg_dump -s -t table database > table_schema.sql
(edit table_schema.sql to remove constraint)
psql database < table_schema.sql
psql database < table_data.sql
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Davis | 2001-01-03 18:11:36 | Numeric and money |
Previous Message | fishbrother | 2001-01-03 15:08:07 | Connection is busy with results to hstm |
From | Date | Subject | |
---|---|---|---|
Next Message | Francis Solomon | 2001-01-03 18:04:14 | RE: order by day or month, etc |
Previous Message | Nikolaj Lundsgaard | 2001-01-03 15:40:54 | Sv: how to build this query ??? Please help !!! |