Mailing List Archive

[Bricolage-General] postgres problems
Hi all,

I am trying to setup a second instance of bricolage for development, I
want to periodically
import the data from my production instance to the my dev instance...
I am trying to dump and restore from one DB to another but I keep
running into problems.
I am using postgres version 7.2.2 (stock version shipped with RH8.0)
both DB's are running on the same machine under the same postmaster.
The problem is that I cannot get the dump to load into the dev db.

pg_dump -F t bric > /tmp/pgdump.tar
pg_restore -d bricdev -N /tmp/pgdump.tar
<snip for brevity>
pg_restore: [archiver (db)] could not execute query: ERROR: Function
'login_avail(varchar, numeric, numeric)' does not exist
Unable to identify a function that satisfies the given argument
types
You may need to add explicit typecasts

I've tried dumping in the plaintext format (calling pg_dump with no
arguments, with args, etc...), but the problem always seems to be that
dependent tables are not re-created
in the order in which they need to be (despite the fact I am using
"pg_restore -N -- restore in original dump order").

Sorry this is so longwinded...but I was hoping that somebody on this
list has run into this problem (this seems like a bug in PG 7.2.2 ) or
could tell me how they go about setting up a second db periodically
importing bric data from another database.

Thanks much,
--
-------------------------
Sean P. Scanlon
perl -le 'print pack("h*", "3707370426c6575646f647e2e65647")'
-------------------------



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general
Re: [Bricolage-General] postgres problems [ In reply to ]
Sean P. Scanlon <sps@bluedot.net> writes:

> pg_dump -F t bric > /tmp/pgdump.tar
> pg_restore -d bricdev -N /tmp/pgdump.tar
> <snip for brevity>
> pg_restore: [archiver (db)] could not execute query: ERROR: Function
> 'login_avail(varchar, numeric, numeric)' does not exist
> Unable to identify a function that satisfies the given
> argument types
> You may need to add explicit typecasts

You have to move the CREATE FUNCTION statement before the CREATE TABLE
statement in the ASCII dump.

PostgreSQL backup is a nightmare and hardly existent.

--
Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT fax +49-711-685-5898


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general
Re: [Bricolage-General] postgres problems [ In reply to ]
On Monday, November 11, 2002, at 08:58 AM, Sean P. Scanlon wrote:

> Sorry this is so longwinded...but I was hoping that somebody on this
> list has run into this problem (this seems like a bug in PG 7.2.2 ) or
> could tell me how they go about setting up a second db periodically
> importing bric data from another database.

This is a shortcoming in pg_dump, and is a known issue. I've reported
it to the PostgreSQL developers here:

http://archives.postgresql.org/pgsql-bugs/2002-09/msg00278.php

You have a few different options to work around this problem. The first
is to simply use "make clone" in your source code distribution, and
then use the SQL file it creates to create your second database.
Another option is to just edit the pg_dump file you're creating in the
same way that make clone does (see inst/clone_sql.pl), that is, remove
from your dump the line that creates the chk_usr__login constraint, and
add to the end of your dump:

ALTER TABLE usr ADD CONSTRAINT ck_usr__login
CHECK (login_avail(LOWER(login), active, id));

And finally, you can also just use SOAP to migrate data from one
installation to another read the bric_soap man page for more on that.

HTH,

David

--
David Wheeler AIM: dwTheory
david@wheeler.net ICQ: 15726394
http://david.wheeler.net/ Yahoo!: dew7e
Jabber: Theory@jabber.org



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general
Re: [Bricolage-General] postgres problems [ In reply to ]
Hi Florian,

Thanks for the info. Can you tell me how I would go about doing that?
I do not see any obvious options to specify order or are you telling me
I need to
craft some sql scripts to do this? I just tried to drop all the data
from all the tables and load
only the data with similar results....

Thanks again,
--
-------------------------
Sean P. Scanlon
perl -le 'print pack("h*", "3707370426c6575646f647e2e65647")'
-------------------------


On Monday, November 11, 2002, at 12:11 PM, Florian Weimer wrote:

> Sean P. Scanlon <sps@bluedot.net> writes:
>
>> pg_dump -F t bric > /tmp/pgdump.tar
>> pg_restore -d bricdev -N /tmp/pgdump.tar
>> <snip for brevity>
>> pg_restore: [archiver (db)] could not execute query: ERROR: Function
>> 'login_avail(varchar, numeric, numeric)' does not exist
>> Unable to identify a function that satisfies the given
>> argument types
>> You may need to add explicit typecasts
>
> You have to move the CREATE FUNCTION statement before the CREATE TABLE
> statement in the ASCII dump.
>
> PostgreSQL backup is a nightmare and hardly existent.
>
> --
> Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
> University of Stuttgart
> http://CERT.Uni-Stuttgart.DE/people/fw/
> RUS-CERT fax +49-711-685-5898
>




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general
Re: [Bricolage-General] postgres problems [ In reply to ]
please ignore my previous post.
I misread Florian's statement about moving statements around in the
actually dump file.

Thanks again,
--
-------------------------
Sean P. Scanlon
perl -le 'print pack("h*", "3707370426c6575646f647e2e65647")'
-------------------------

On Monday, November 11, 2002, at 12:11 PM, Florian Weimer wrote:

> Sean P. Scanlon <sps@bluedot.net> writes:
>
>> pg_dump -F t bric > /tmp/pgdump.tar
>> pg_restore -d bricdev -N /tmp/pgdump.tar
>> <snip for brevity>
>> pg_restore: [archiver (db)] could not execute query: ERROR: Function
>> 'login_avail(varchar, numeric, numeric)' does not exist
>> Unable to identify a function that satisfies the given
>> argument types
>> You may need to add explicit typecasts
>
> You have to move the CREATE FUNCTION statement before the CREATE TABLE
> statement in the ASCII dump.
>
> PostgreSQL backup is a nightmare and hardly existent.
>
> --
> Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
> University of Stuttgart
> http://CERT.Uni-Stuttgart.DE/people/fw/
> RUS-CERT fax +49-711-685-5898
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Bricolage-General mailing list
> Bricolage-General@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bricolage-general
>




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general
Re: [Bricolage-General] postgres problems [ In reply to ]
Sean P. Scanlon <sps@bluedot.net> writes:

> Thanks for the info. Can you tell me how I would go about doing
> that? I do not see any obvious options to specify order or are you
> telling me I need to craft some sql scripts to do this?

Just load the dump into a text editor and reorder the SQL statements
as necessary.

--
Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT fax +49-711-685-5898


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general