Skip site navigation (1) Skip section navigation (2)

Re: pg_dump: relation "..." already exists warning

From: Ennio-Sr <nasr(dot)laili(at)tin(dot)it>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: pg_dump: relation "..." already exists warning
Date: 2005-09-18 00:34:28
Message-ID: 20050918003427.GA17436@deby.ei.hnet (view raw or flat)
Thread:
Lists: pgsql-novice
* Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> [170905, 18:05]:
> Ennio-Sr <nasr(dot)laili(at)tin(dot)it> writes:
> > running the command:
> > $ pg_dump finanz -t ult_qq | psql finanza ennio ult.qq
> 
> > I can see that table 'ult_qq' is regularly created in 'finanza' and
> > continues to exist in 'finanz', although pg is firing this warning:
> 
> > SET
> > SET
> > SET
> > SET
> > ERROR:  relation "ult_qq" already exists
> > SET
> > ERROR:  relation "ult_qq" already exists
> > SET
> > SET
> 
> > which I'm unable to explain.
> 
> It seems fairly easily explainable to me: the table already exists.
> Perhaps because you already restored into this destination database?
> 
> 			regards, tom lane

Well, AAMOF, that command is in a script and follows a 'drop table
ult_qq' instruction:
-----------
# ...... as the table 'ult_qq' was created during a previous running of
# the script,
# we first delete it:
psql finanza -c "drop table ult_qq;"

# psql finanza -c "vacuum full analyze ult_qq;" ## doesn't help !
# and then dump it to the other db (finanza):
pg_dump finanz -t ult_qq | psql finanza ennio ult_qq    [***]

# So that, in 'finanza', we can update our 'dep_tit' table:
psql finanza -c "update dep_tit set ultima_quot=ult_qq.pr_chius, \
data_ult_q=ult_qq.quot_del where dep_tit.cod_tit=ult_qq.cod_tit;"
# .......
------------
[***] I copied this instruction somewhere from: it works, but I don't
know exactly whether, and if yes where, the dump is saved in 'finanz'
also.
May be the warning refers to the presence of 'ult_qq' in finanz? Or,
perhaps, the dropping is still running when the dump is started?

Let me stress again that despite the warning everything is working
smoothly and a _new_ 'ult_qq' is copied to finanza on any subsequent
script running.

Thanks for your time, Tom!
Regards,
	Ennio.

-- 
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.   \\?//
 Fa' qualche cosa di cui non sei capace!"  (diceva Henry Miller) ]    (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that.              )=(
 Do something you aren't good at!" (as Henry Miller used to say) ]

In response to

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2005-09-18 03:45:24
Subject: Re: pg_dump: relation "..." already exists warning
Previous:From: Tom LaneDate: 2005-09-17 22:05:19
Subject: Re: pg_dump: relation "..." already exists warning

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group