Re: calling a function within a view causes problems doing a pg_dumpall - Mailing list pgsql-sql

From Josh Berkus
Subject Re: calling a function within a view causes problems doing a pg_dumpall
Date
Msg-id web-52454@davinci.ethosmedia.com
Whole thread Raw
In response to calling a function within a view causes problems doing a pg_dumpall  (juerg.rietmann@pup.ch)
List pgsql-sql
Juerg,

> I need to transfer a db form one to another server. I wanted to do
> this
> with pg_dumpall and psql -e ....

Have you tried just using pg_dump instead of pg_dumpall?  I understand
that there were a few bugs in pg_dumpall, and pg_dump will mean less
data to transfer.

> CREATE FUNCTION buildString(bpchar) RETURNS text AS '
>         DECLARE
>                 list           text;
>                 rec          record;
>         BEGIN
>         list := '''';
>           FOR rec IN SELECT z_u_umfang FROM zylinder_umfang WHERE
> z_u_typ
> = $1;
>              list := list || text(rec.z_u_umfang) || '','';
>           END LOOP;
>           RETURN list;
>         END;
> ' LANGUAGE 'plpgsql';

It would be nice to see the errors you're getting when you try to
restore.  Could it be as simple as the dump file trying to create the
view before the function?  Or plpgsql not being defined as a language on
the target server?

BTW, there is a better-performance way to do the same thing you're doing
with that function.  Please browse the list archives with a search for
'catenate' -- you'll find a discussion of custom aggregates which
concatinate strings.

-Josh



______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


pgsql-sql by date:

Previous
From: Ian Harding
Date:
Subject: Re: Need help with search-and-replace
Next
From: Oliver Seidel
Date:
Subject: OFFTOPIC: search and replace with unix tools