How do you backup functions only? - Mailing list pgsql-novice

From Andrew Walmsley
Subject How do you backup functions only?
Date
Msg-id B67C1491364AE5468606C90374E790F31C07BD@cerberus.preston.traveltech.co.uk
Whole thread Raw
Responses Re: How do you backup functions only?
List pgsql-novice
We have a reasonably sized postgres database where we want to make
coding changes to the functions within it.
Before we alter the functions, it would be a good idea to backup the
current functions in the database. The database itself is too large to
do a full backup every time we make a coding change.
We currently use the following script to backup (some of the) functions.

bash-3.00$ cat backup_phpcron.sh
DATE=`date "+%Y%m%d"`

if [ -r phpcron-$DATE.sql.gz ]
then
    echo "ABORTED phpcron-$DATE.sql.gz already exists"
    exit 1
fi

psql -At <<-'!' | gzip -c > phpcron-$DATE.sql.gz || exit 1
\df+ avail_oneway
\df+ avail_return
\df+ clear_flightdata
\df+ clear_flightdata_update
\df+ load_flights
\df+ load_flights_update
\df+ load_prices
\df+ load_prices_update
\df+ load_routes
\df+ prepare_avlpkgs
\df+ prepare_avlpkgs_update
!

This creates a non-restorable snapshot of the functions. Is there a way
to output the functions (only) so that they can be restored in one easy
operation if there is an error in the new code? An option to pg_dump
that I have missed perhaps?

Thanks in advance.

--
Andrew Walmsley
Software Development
Travel Technology Systems Ltd.
2 Nile Close, Riversway
Preston, PR2 2XU
Tel: 01772 766800
Fax: 01772 766801

(please note the new address and contact number)

This Email may contain information of a confidential and/or privileged
nature.
The information transmitted is intended only for the benefit of the
person or entity to which it is addressed and must not be copied or
forwarded without the sender's express permission.
This Email does not reflect the views or opinions of Travel Technology
Systems Ltd.
This Email is without prejudice.
This Email does not constitute an agreement either explicitly or
implicitly with Travel Technology Systems Ltd.

pgsql-novice by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Uppercase initials in Win XP
Next
From:
Date:
Subject: How to enable remote anoymous logins? (+ admin books?)