Thread: pg_restore problem

pg_restore problem

From
Bradley Miller
Date:
I'm attempting to restore a dump from one server to another (one is a
Mac and one is a Linux base, if that makes any difference).  I keep
running into issues like this:

pg_restore: [archiver (db)] could not execute query: ERROR:  function
public.random_page_link_id_gen() does not exist

This is what I'm using to restore the files with:

pg_restore -O -x -s -N -d nuvio mac_postgres_2_2_2005_13_24

Any suggestions on how to get around this problem?  It's a huge pain so
far just to sync my two servers up.

Bradley Miller
NUVIO CORPORATION
Phone: 816-444-4422 ext. 6757
Fax: 913-498-1810
http://www.nuvio.com
bmiller@nuvio.com

Re: pg_restore problem

From
"Joel Fradkin"
Date:

I used pgadmin to save and mine would not restore saying something about the encoding.

I will have to be able to save and restore reliably as well.

 

Also I never heard anything further on the query running slow (I put up table defs and analyze with and without seq on).

I am running into this on several of my views (I guess I am not too bright, because I still don’t get why it chooses seq scan on indexed tables).

I can force it to use index and did see a little improvement, but the MSSQL was 3 secs and Postgres was like 9.

Seeing as how I got the one viw to return faster (it was very complex view) on postgres, my guess is I still have stuff to do. I did try changing the cost to a lower number in config and redid my analyze, but it was still trying to do a seq scan.

 

Joel Fradkin

 

Wazagua, Inc.
2520 Trailmate Dr
Sarasota, Florida 34243
Tel.  941-753-7111 ext 305

 

jfradkin@wazagua.com
www.wazagua.com
Powered by Wazagua
Providing you with the latest Web-based technology & advanced tools.
© 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
 This email message is for the use of the intended recipient(s) and may contain confidential and privileged information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and delete and destroy all copies of the original message, including attachments.

 


 

-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Bradley Miller
Sent: Wednesday, February 02, 2005 3:17 PM
To: Postgres List
Subject: [SQL] pg_restore problem

 

I'm attempting to restore a dump from one server to another (one is a Mac and one is a Linux base, if that makes any difference). I keep running into issues like this:

pg_restore: [archiver (db)] could not execute query: ERROR: function public.random_page_link_id_gen() does not exist

This is what I'm using to restore the files with:

pg_restore -O -x -s -N -d nuvio mac_postgres_2_2_2005_13_24

Any suggestions on how to get around this problem? It's a huge pain so far just to sync my two servers up.

Bradley Miller
NUVIO CORPORATION
Phone: 816-444-4422 ext. 6757
Fax: 913-498-1810
http://www.nuvio.com
bmiller@nuvio.com

Re: pg_restore problem

From
Tom Lane
Date:
Bradley Miller <bmiller@nuvio.com> writes:
> I'm attempting to restore a dump from one server to another (one is a 
> Mac and one is a Linux base, if that makes any difference).  I keep 
> running into issues like this:

> pg_restore: [archiver (db)] could not execute query: ERROR:  function 
> public.random_page_link_id_gen() does not exist

Is this a problem of items in the dump being in the wrong order (ie,
there's a forward reference to random_page_link_id_gen())?

> Any suggestions on how to get around this problem?

Use 8.0 ... or use pg_restore's -L/-l options to manually adjust the
load order.  Pre-8.0 versions of pg_dump are easily fooled if you use
ALTER to make earlier-created objects reference later-created objects.
        regards, tom lane


Re: pg_restore problem

From
Bradley Miller
Date:
So in the current version I'm running (7.4.6) and I do a pg_dump I have
to then manually manipulate the order by doing a -l to get a table of
contents and then reorder (just changing the first number; or the oid
also??) just to get it to work right?   Does anyone else have these
issues?  How exactly can I use this on a mission critical app with
flaws like this?   How do other people work with this?  Do they just
not dump the files and restore?


On Feb 2, 2005, at 3:24 PM, Tom Lane wrote:

> Bradley Miller <bmiller@nuvio.com> writes:
>> I'm attempting to restore a dump from one server to another (one is a
>> Mac and one is a Linux base, if that makes any difference).  I keep
>> running into issues like this:
>
>> pg_restore: [archiver (db)] could not execute query: ERROR:  function
>> public.random_page_link_id_gen() does not exist
>
> Is this a problem of items in the dump being in the wrong order (ie,
> there's a forward reference to random_page_link_id_gen())?
>
>> Any suggestions on how to get around this problem?
>
> Use 8.0 ... or use pg_restore's -L/-l options to manually adjust the
> load order.  Pre-8.0 versions of pg_dump are easily fooled if you use
> ALTER to make earlier-created objects reference later-created objects.
>
>             regards, tom lane
>
>
Bradley Miller
NUVIO CORPORATION
Phone: 816-444-4422 ext. 6757
Fax: 913-498-1810
http://www.nuvio.com
bmiller@nuvio.com

Re: pg_restore problem

From
Richard Huxton
Date:
Bradley Miller wrote:
> So in the current version I'm running (7.4.6) and I do a pg_dump I have 
> to then manually manipulate the order by doing a -l to get a table of 
> contents and then reorder (just changing the first number; or the oid 
> also??) just to get it to work right?   Does anyone else have these 
> issues?  How exactly can I use this on a mission critical app with flaws 
> like this?   How do other people work with this?  Do they just not dump 
> the files and restore?

The problem(s) are only apparent if you define/redefine objects in a 
certain order. I've tended to encounter them on databases where I've 
extensively reworked elements (particularly functions/views). In 
particular, dumping a restored database always seems OK for me.

With the -l file, you just need to cut & paste the lines into the 
correct order. In practice, I tend to just move half-a-dozen lines to 
the end of the file to get things to work. The crucial bit then is to 
make sure you keep a backup copy of the working order somewhere - you 
have no idea how often I've deleted the file as soon as I've finished 
restoring.

Of course, if you have dynamic functions in say perl/tcl and then base 
views on them there's probably no way for pg_dump to ever figure out the 
correct dependencies.

--  Richard Huxton  Archonet Ltd


Re: pg_restore problem

From
Bradley Miller
Date:
Interestingly, I made a new database on my test server and then was
able to do a pg_dump from my mac box to the test server and I think it
got just about everything . . . I've got some constraint issues and
other oddities happening, but at least my functions came in fine.  I
used the pipe command to pipe it directly to the server rather than
using pg_restore.


Bradley Miller
NUVIO CORPORATION
Phone: 816-444-4422 ext. 6757
Fax: 913-498-1810
http://www.nuvio.com
bmiller@nuvio.com