From: | "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "Naoko Reeves *EXTERN*" <naoko(at)lawlogix(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: how to Export ALL plpgsql functions/triggers to file |
Date: | 2009-10-15 10:40:43 |
Message-ID: | D960CB61B694CF459DCFB4B0128514C203937F9B@exadv11.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Naoko Reeves wrote:
> Could you tell me how to Export ALL plpgsql
> functions/triggers to file?
I'd do it as follows:
- Perform a pg_dump of the database object definitions:
pg_dump -F c -s -f database.dmp database
- Create a listing, delete everything except triggers and functions:
pg_restore -l database.dmp | awk '/[0-9]*; [0-9]* [0-9]* (FUNCTION|TRIGGER)/ { print }' > database.list
- Create an SQL script with only these objects:
pg_restore -L database.list -f database.sql database.dmp
The only shortcoming is that it does not make a distinction
between PL/pgSQL and other functions; you could filter again with awk
or something if you need that.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2009-10-15 10:48:02 | Re: Too easy to log in as the "postgres" user? |
Previous Message | Thom Brown | 2009-10-15 10:38:00 | Too easy to log in as the "postgres" user? |