Re: pg_dump: relation "..." already exists warning - Mailing list pgsql-novice

From Ennio-Sr
Subject Re: pg_dump: relation "..." already exists warning
Date
Msg-id 20050918003427.GA17436@deby.ei.hnet
Whole thread Raw
In response to Re: pg_dump: relation "..." already exists warning  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_dump: relation "..." already exists warning
List pgsql-novice
* Tom Lane <tgl@sss.pgh.pa.us> [170905, 18:05]:
> Ennio-Sr <nasr.laili@tin.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) ]

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump: relation "..." already exists warning
Next
From: Tom Lane
Date:
Subject: Re: pg_dump: relation "..." already exists warning