Re: To take backup of Postgresql Database without large objects - Mailing list pgsql-general

From sivapostgres@yahoo.com
Subject Re: To take backup of Postgresql Database without large objects
Date
Msg-id 1494046583.828048.1744434369825@mail.yahoo.com
Whole thread Raw
In response to Re: To take backup of Postgresql Database without large objects  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: To take backup of Postgresql Database without large objects
Re: To take backup of Postgresql Database without large objects
List pgsql-general
I tried all the combinations, as mentioned in the document

"E:\DBBackup\bin\pg_dump.exe" -h 192.168.1.1 -p 5432 -U <username> --no-blobs -F c -v -f "E:\DBBackup\demo6_110420251637.bak" demo6 

"E:\DBBackup\bin\pg_dump.exe" -h 192.168.1.1 -p 5432 -U <username> -B -F c -v -f "E:\DBBackup\demo6_110420251637.bak" demo6 

"E:\DBBackup\bin\pg_dump.exe" -h 192.168.1.1 -p 5432 -U <username> -B --no-blobs -F c -v -f "E:\DBBackup\demo6_110420251637.bak" demo6 

With version 15
--no-large-objects  is not working.
I tried with all the other combinations.  NO LUCK.

bytea field also included in the backup.   

I tried taking backup using pg_dump of version 17 also, with no luck.   [ Database version is 15 and the pg_dump version is 17 ]. 

Confirming this after restoring the backup file in a new database.   The new database contains contents from bytea field also.  

Either my command should be wrong or I'm missing something.  

Happiness Always
BKR Sivaprakash

On Friday 11 April, 2025 at 08:31:31 pm IST, Adrian Klaver <adrian.klaver@aklaver.com> wrote:


On 4/11/25 05:55, sivapostgres@yahoo.com wrote:
> Hello,
>
> Using PostgreSQL 15.1, compiled by Visual C++ build 1914, 64-bit in
> Windows 10.
>
> Trying to take backup of a database, using pg_dump, where one table
> contains bytea datatype, which I don't want to include in the backup.
>
> My command was:
> "E:\DBBackup\bin\pg_dump.exe"  -h 192.168.1.1 -p 5432 -U <username>
> --no-blobs -F c -v -f "E:\DBBackup\demo6_110420251637.bak" demo6
>
> the backup includes the bytea field also.
>
> I tried with
> "E:\DBBackup\bin\pg_dump.exe"  -h 192.168.1.1 -p 5432 -U <username> -B
> -F c -v -f "E:\DBBackup\demo6_110420251637.bak" demo6
>
> also, which also included the bytea field.

1) Short version

Short version bytea fields != large objects.

2) Long version

From here:

https://www.postgresql.org/docs/current/app-pgdump.html

-B
--no-large-objects
--no-blobs (deprecated)

    Exclude large objects in the dump.

    When both -b and -B are given, the behavior is to output large
objects, when data is being dumped, see the -b documentation.

Where large objects are defined here:

https://www.postgresql.org/docs/current/largeobjects.html





>
> What wrong I'm doing?  Couldn't figure it out.   Any help is appreciated.
>
> Happiness Always
> BKR Sivaprakash

>

--
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Clarification on the docs
Next
From: "David G. Johnston"
Date:
Subject: Re: To take backup of Postgresql Database without large objects