Thread: PG 9 adminstrations
Hi all,
I am trying to update / refresh one table (history) only from prod. database to my test environment database
my query as follows:
but I am getting the following error
psql: FATAL: database "history" does not exist
Can you help please?
what would be the script if I want more than one table (3 tables to refresh)
Kind regards
You don't need "-t history" on the psql part. It doesn't do what you think it does, and it's reading the next part ("history") as the database name.
try:
pg_dump -h <hostname1> -U postgres -t history DATABASENAME | psql -h hostname2 -U postgres DATABASENAME > db.sql
Derrick
try:
pg_dump -h <hostname1> -U postgres -t history DATABASENAME | psql -h hostname2 -U postgres DATABASENAME > db.sql
Derrick
On Tue, Sep 20, 2011 at 11:57 PM, Hany ABOU-GHOURY <hghoury@gmail.com> wrote:
Hi all,I am trying to update / refresh one table (history) only from prod. database to my test environment databasemy query as follows:pg_dump -h <hostname1> -U postgres -t history DATABASENAME | psql -h hostname2 -U postgres -t history DATABASENAME > db.sqlbut I am getting the following errorpsql: FATAL: database "history" does not existCan you help please?what would be the script if I want more than one table (3 tables to refresh)Kind regards
Thanks but...did not work different error though
ERROR: relation "history" already exists
ERROR: relation "idx_history_pagegroupid" already exists
ERROR: constraint "cdocumentid" for relation "history" already exists
On Wed, Sep 21, 2011 at 4:16 PM, Derrick Rice <derrick.rice@gmail.com> wrote:
You don't need "-t history" on the psql part. It doesn't do what you think it does, and it's reading the next part ("history") as the database name.
try:
pg_dump -h <hostname1> -U postgres -t history DATABASENAME | psql -h hostname2 -U postgres DATABASENAME > db.sql
DerrickOn Tue, Sep 20, 2011 at 11:57 PM, Hany ABOU-GHOURY <hghoury@gmail.com> wrote:Hi all,I am trying to update / refresh one table (history) only from prod. database to my test environment databasemy query as follows:pg_dump -h <hostname1> -U postgres -t history DATABASENAME | psql -h hostname2 -U postgres -t history DATABASENAME > db.sqlbut I am getting the following errorpsql: FATAL: database "history" does not existCan you help please?what would be the script if I want more than one table (3 tables to refresh)Kind regards
On 09/20/2011 11:29 PM, Hany ABOU-GHOURY wrote: > Thanks but...did not work different error though > > ERROR: relation "history" already exists > ERROR: relation "idx_history_pagegroupid" already exists > ERROR: constraint "cdocumentid" for relation "history" already exists Clearly the history table already exists on your second host. This may or may not matter, if the table definitions are the same. If the table on host2 was empty, it'll be filled with the data from host1. If not, you'll need to truncate the table on host2 first. If you don't want the complaints about tables or indexes or constraints that already exist, use the -a option for data-only dumps. Also, might I suggest using the pgsql-novice list? They're more likely to help with general issues like this. -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604 312-676-8870 sthomas@peak6.com ______________________________________________ See http://www.peak6.com/email-disclaimer/ for terms and conditions related to this email