Solved

Disabling constraints in PostgreSQL?

Posted on 2006-07-11
3
3,660 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

829 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