Search Postgresql Archives

Re: how to Export ALL plpgsql functions/triggers to file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux