Solved

Disabling constraints in PostgreSQL?

Posted on 2006-07-11
3
3,644 Views
Last Modified: 2012-06-27
We are converting a data import application from Oracle to PostgreSQL and are having some issues with functionality in Oracle that's missing in PostgreSQL.

In Oracle, we do the following simple bit to disable constraints: ALTER TABLE $table DISABLE CONSTRAINT $constraint
But in PostgreSQL, we can find no functional equivalent.

Ideas?

You can drop constraints and re-add them of course, but this is very inefficient.
0
Comment
Question by:kcorbinakc
3 Comments
 
LVL 17

Accepted Solution

by:
rstaveley earned 500 total points
ID: 17089510
As far as I can gather, you can disable constraint triggers only, which isn't much help to you. Wait for confirmation from a real PostgreSQL expert, though 8-)
0
 
LVL 22

Expert Comment

by:earth man2
ID: 17112406
alter table x DROP CONSTRAINT yyyy;

alter table x ADD CONSTRAINT ...
0
 

Author Comment

by:kcorbinakc
ID: 17196264
We did get confirmation from our PostgreSQL provider that that is the only way to disable constraints.  Here's our syntax:
UPDATE pg_class SET reltriggers = 0 WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = ?)

Thanks for the input.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question