Re: Restoring a table with a different name - Mailing list pgsql-general

From Mike Nolan
Subject Re: Restoring a table with a different name
Date
Msg-id 200402280203.i1S23Rc3005039@gw.tssi.com
Whole thread Raw
In response to Re: Restoring a table with a different name  ("Jim Wilson" <jimw@kelcomaine.com>)
Responses Re: Restoring a table with a different name
Re: Restoring a table with a different name
List pgsql-general
> > If I edit the dump file with 'sed' to change the table name, I get
> > 'invalid command \N' errors trying to reload it.
>
> What sed syntax are you using?

Here's the command line I used:

   sed -e 's/memmast/wk_memmast/' memmast.dmp > wk_memmast.dmp

I see two potential problems here, and it took both of them to bite me.

One is that I'm not changing all occurrences of 'memmast' to 'wk_memmast'.
The other is that the string 'memmast' can and does occur within the
name of another column, so the name of that column was edited by sed
in the CREATE TABLE statement but not in the LOAD command.

Changing the command line to:

   sed -e 's/ memmast / wk_memmast /' memmast.dmp > wk_memmast.dmp

works, and without changing that column name.

I think, however, that I may need to go with the other method (copying
the table and dumping/restoring the copy), because the restore runs into
name conflicts with several indexes and there is a trigger procedure
on that table.
--
Mike Nolan

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Regarding BITs vs. INTs
Next
From: Adam Ruth
Date:
Subject: Re: Restoring a table with a different name