[SQL] Disabling constraint check

2012-09-17 Thread Salomao Domingos
Hi,

I'm need to import data to PostgreSQL via csv file. The database in
question is very problematic and I have that import those data without
checking it. How can I to do that? I know that I can to disable FKs
through "ALTER TABLE table_name DISABLE TRIGGERS ALL", however how can
I disabling CHECK CONSTRAINT too?

--
* Salomão Domingos
  * * Analista de Suporte
* * * Linux Professional Institute Certificate 2 - LPIC2
  * * * * e-mail comercial: [email protected]
* * * * * MSN : [email protected]


-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] Disabling constraint check

2012-09-17 Thread Oliveiros d'Azevedo Cristina

Have you tried this

ALTER TABLE table_name DROP CONSTRAINT constraint_name;
Best,
Oliveiros

- Original Message - 
From: "Salomao Domingos" 

To: 
Sent: Monday, September 17, 2012 7:58 PM
Subject: [SQL] Disabling constraint check


Hi,

I'm need to import data to PostgreSQL via csv file. The database in
question is very problematic and I have that import those data without
checking it. How can I to do that? I know that I can to disable FKs
through "ALTER TABLE table_name DISABLE TRIGGERS ALL", however how can
I disabling CHECK CONSTRAINT too?

--
   * Salomão Domingos
 * * Analista de Suporte
   * * * Linux Professional Institute Certificate 2 - LPIC2
 * * * * e-mail comercial: [email protected]
* * * * * MSN : [email protected]


--
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



--
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] Disabling constraint check

2012-09-17 Thread Richard Broersma
On Mon, Sep 17, 2012 at 11:58 AM, Salomao Domingos <
[email protected]> wrote:

> ... however how can I disabling CHECK CONSTRAINT too?
>

>From the sub-section on DEFERRABLE NOT DEFERRABLE:
http://www.postgresql.org/docs/9.2/interactive/sql-createtable.html#SQL-CREATETABLE-EXCLUDE

You cannot disable a check constraint.

Perhaps a staging table is advisable here?

-- 
Regards,
Richard Broersma Jr.