Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Disabling constraints in PostgreSQL?

Posted on 2006-07-11
3
Medium Priority
?
3,790 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 17

Accepted Solution

by:
rstaveley earned 1500 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

610 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