Re: [GENERAL] how do I do dump and restore without bugging with constraint?

From: Thillai Selvan <thillaict(at)yahoo(dot)com>
To: "Net Tree Inc(dot)" <nettreeinc(at)gmail(dot)com>, pgsql-admin(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] how do I do dump and restore without bugging with constraint?
Date: 2010-02-24 04:43:41
Message-ID: 166209.57794.qm@web95315.mail.in2.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

I have tried like this.
But in my case it is not working when trying to access a column that is not exists in the table.

Example:

CREATE TABLE test_str (te_id text);

INSERT INTO test_str VALUES ('a');
INSERT INTO test_str VALUES ('b');
INSERT INTO test_str VALUES ('c');

SELECT t.name from test_str t;

I am getting error like this.

ERROR:  column t.name does not exist

--- On Wed, 24/2/10, Net Tree Inc. <nettreeinc(at)gmail(dot)com> wrote:

From: Net Tree Inc. <nettreeinc(at)gmail(dot)com>
Subject: Re: [GENERAL] how do I do dump and restore without bugging with constraint?
To: pgsql-admin(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Date: Wednesday, 24 February, 2010, 1:57 AM

I see something related with Deferrable and Initially deferrable that
seems like something could avoid constraints when dumping and restore,
but it has to modify the table or re-create all of them to have such
option (maybe is what you referraled "table definitions"). Is it what
it can be use for to avoid during dumping and restoring?

DEFERRABLE

NOT DEFERRABLE
This controls whether the constraint can be deferred. A constraint that
is not deferrable will be checked immediately after every command.
Checking of constraints that are deferrable can be postponed until the
end of the transaction (using the SET CONSTRAINTS command). NOT DEFERRABLE
is the default. Only foreign key constraints currently accept this
clause. All other constraint types are not deferrable. INITIALLY IMMEDIATE

INITIALLY DEFERRED
If a constraint is deferrable, this clause specifies the default time
to check the constraint. If the constraint is INITIALLY IMMEDIATE, it is checked after each statement. This is the default. If the constraint is INITIALLY DEFERRED, it is checked only at the end of the transaction. The constraint check time can be altered with the SET CONSTRAINTS command.

On Tue, Feb 23, 2010 at 12:50 PM, Net Tree Inc. <nettreeinc(at)gmail(dot)com> wrote:

Hi all,
I am dumping both schema and data from old database to new one. The new database schema is somehow contain slightly different schema then the old one. When I do restore it shown alot errors related with constraints. How can I dump and to restore from old to new without dealing with constraint and just forces data dump to where it suppose to belong?

--
---------------------------------------
Steven Huang

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Iñigo Martinez Lasala 2010-02-24 08:31:54 Re: how do I do dump and restore without bugging with constraint?
Previous Message Net Tree Inc. 2010-02-24 01:57:14 Re: how do I do dump and restore without bugging with constraint?

Browse pgsql-general by date

  From Date Subject
Next Message Lew 2010-02-24 05:37:05 Re: typecaste object to array
Previous Message Baron Schwartz 2010-02-24 04:08:22 Re: Sorting performance vs. MySQL