Thread: Specific objects backup in PostgreSQL

Specific objects backup in PostgreSQL

From
nikhil kumar
Date:
Dear Team,

We received a request from client. They required all functions, stored procedures and triggers backup. can anyone please let me know. How to take backup only above objects. 


Thanks & Regards,
Nikhil, 
PostgreSQL DBA.

Re: Specific objects backup in PostgreSQL

From
"David G. Johnston"
Date:
On Wed, Jul 10, 2024 at 11:05 AM nikhil kumar <nikhil.dba97@gmail.com> wrote:

We received a request from client. They required all functions, stored procedures and triggers backup. can anyone please let me know. How to take backup only above objects. 

This hardly qualifies as a performance question.

You might try the -general list if you want to brainstorm workarounds because pg_dump itself doesn't provide any command line options to give you this specific subset of your database.

David J.

Re: Specific objects backup in PostgreSQL

From
Olivier Gautherot
Date:
Hi Nikhil,

On Wed, Jul 10, 2024 at 8:05 PM nikhil kumar <nikhil.dba97@gmail.com> wrote:
Dear Team,

We received a request from client. They required all functions, stored procedures and triggers backup. can anyone please let me know. How to take backup only above objects. 


Thanks & Regards,
Nikhil, 
PostgreSQL DBA.

"pg_dump -s" will export the model, including functions, triggers... as well as tables and views without data.

I should have somewhere an old program I wrote on a lazy day to slice this backup into individual objects. I can dig it for you if you need it.

Cheers
--
Olivier Gautherot

Re: Specific objects backup in PostgreSQL

From
Anthony Sotolongo
Date:
Hi Nikhil, maybe you can apply some tricks playing with pg_dump -s and 
pg_restore --list


check this link: https://stackoverflow.com/a/13758324/8308381


Regards

On 10-07-24 14:05, nikhil kumar wrote:
> Dear Team,
>
> We received a request from client. They required all functions, stored 
> procedures and triggers backup. can anyone please let me know. How to 
> take backup only above objects.
>
>
> Thanks & Regards,
> Nikhil,
> PostgreSQL DBA.



Re: Specific objects backup in PostgreSQL

From
nikhil kumar
Date:

Thank you everyone for your help

On Thu, 11 Jul, 2024, 1:34 am Anthony Sotolongo, <asotolongo@gmail.com> wrote:
Hi Nikhil, maybe you can apply some tricks playing with pg_dump -s and
pg_restore --list


check this link: https://stackoverflow.com/a/13758324/8308381


Regards

On 10-07-24 14:05, nikhil kumar wrote:
> Dear Team,
>
> We received a request from client. They required all functions, stored
> procedures and triggers backup. can anyone please let me know. How to
> take backup only above objects.
>
>
> Thanks & Regards,
> Nikhil,
> PostgreSQL DBA.