public inbox for [email protected]
help / color / mirror / Atom feedFrom: Srinath Reddy <[email protected]>
To: Mahendra Singh Thalor <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Re: Non-text mode for pg_dumpall
Date: Mon, 3 Feb 2025 14:23:38 +0530
Message-ID: <CAFC+b6pWQiSL+3rvLxN9vhC8aONp4OV9c6u+BVD6kmWmDbd1WQ@mail.gmail.com> (raw)
In-Reply-To: <CAKYtNApkrfDHyN5z+Spbat1xzVOEL9y5o+ALimYmb3eH3T8Vhw@mail.gmail.com>
References: <CAKYtNAp9vOtydXL3_pnGJ+TetZtN=FYSnZSMCqXceU3mkHPxPg@mail.gmail.com>
<[email protected]>
<CAKYtNAo-6HZy-JhTYS321AxGE_BPCg7WTFVLeXTuFMZ6HYK2vg@mail.gmail.com>
<CACJufxGcZ1rK94cgfdc9McCD7W-83PT9_cx5VoFeC-HVc10Wzg@mail.gmail.com>
<CAKYtNAqd4k+4+XANxjDc35i+WPme476DkP7msjYpX85F+4UsUg@mail.gmail.com>
<CAKYtNAobHS158cfmA3X+Zr+oJ1ffNjjn3+BrU4-MokZ16jSVzw@mail.gmail.com>
<CACJufxEtDgADBXQhX5cp3mJtNVMy+j+Jdovuk3PWe5qJ0sE3Ag@mail.gmail.com>
<CAKYtNArwUxqR=LkQY1PT7tw+raMhf53oafo4WmSHGPHiER9d=A@mail.gmail.com>
<CACJufxHUDGWe=2ZukvMfuwEcSK8CsVYm=9+rtPnrW7CRCfoCsw@mail.gmail.com>
<CACJufxGOy1kAot+SAD9siKB797rj9K-bqeZOrS4fDYFFLo31bA@mail.gmail.com>
<CAKYtNApE=x0sZxU3c9KqsYRU3dCztcfhQ+CDWhzgtH83HQUkuA@mail.gmail.com>
<CACJufxHNNjAhVYJQS8x5U-9Fqsj6+tzG4uCivk2XTAOPTmstTA@mail.gmail.com>
<CACJufxFJ9yJ=+WAHpXbDxf077Xw3O+ZziTwS55+ZK5APJ+6mUg@mail.gmail.com>
<CACJufxEA-Q2hatN_BLcNrgfo8-4-m102gDdwVp0NTbuM2zyeDA@mail.gmail.com>
<CAKYtNAqWjU6-J=VA-9-CVDLh7nX_Y_MgdSgyLFb6yYyZ1NYsyg@mail.gmail.com>
<CACJufxEFxaiqytZRpL0Xbj8_XEtTm8-A2FE6u_9vigGO3z5oZQ@mail.gmail.com>
<CAKYtNAr732dgvu43vLRBnDK=dPBVWAFBKaCp0982kwp0Yn8DOA@mail.gmail.com>
<CACJufxGwXjG80LZ4miX+dXaT+3z5Kf1Mf0P_7FnR+641oqfUyg@mail.gmail.com>
<CACJufxEQUcjBocKJQ0Amf3AfiS9wFB7zYSHrj1qqD_oWeaJoGQ@mail.gmail.com>
<CAKYtNApzcsV3a_jR6oduA12yKrx=aBv+vcA=RseT-2rLrC2o_g@mail.gmail.com>
<CAFC+b6p84_wtbviPu-mLNxfOPLozN8OOjWcz_tjoDf=SuVDMTQ@mail.gmail.com>
<CAFC+b6qJ9BAmN-J2ha-Q08MPbZ2FqTUB++B0ouvSk72px3D-NA@mail.gmail.com>
<CAKYtNAqsOwq-u-h0+WEm2nonwZD4S=9ri4-d0vhAGjNQZ7FjnQ@mail.gmail.com>
<CAKYtNAr+YSMu1TkyXzsxtvCMRoya05_=1V_LFKDrL=XpYJ9DxQ@mail.gmail.com>
<CACJufxGp5p7_7EwNwg-GuKZO+XB9uxfWTZ+QWhhNvwgUF0Vb0w@mail.gmail.com>
<CACJufxGoUgqv+T1MXuh_SH_FTwTMpqfUcntHP1c5Q7KnyPXgKQ@mail.gmail.com>
<CACJufxFWFLZhtgk92HR78tKiYk0yRX-26v2y1eEN2NtjyXtU4A@mail.gmail.com>
<CAKYtNApkrfDHyN5z+Spbat1xzVOEL9y5o+ALimYmb3eH3T8Vhw@mail.gmail.com>
Hi,
I found a bug ,while using "./pg_restore pdd -f -" actually it has to copy
everything(global sql commands + remaining dump ) into stdout as per the
"-f, --file=FILENAME output file name (- for stdout)" but it is
copying global sql commands to a file literally naming it as "-" and
remaining dump is written to stdout without those global sql commands."-"
is not a output file it signifies stdout in terminal cmds.so we have to
handle this case.
because of above reason "./pg_restore pdd -g -f -" also does the same
creates a file "-" and writes globals to that file instead of stdout.
This is the delta patch to handle this case.please have a look and give
some feedback.
@@ -84,7 +84,7 @@ static int restoreAllDatabases(PGconn *conn, const char
*dumpdirpath,
SimpleStringList
db_exclude_patterns, RestoreOptions *opts, int numWorkers);
static void execute_global_sql_commands(PGconn *conn, const char
*dumpdirpath,
const char *outfile);
-static void copy_global_file_to_out_file(const char *outfile, FILE *pfile);
+static void copy_global_file(const char *outfile, FILE *pfile);
static int filter_dbnames_for_restore(PGconn *conn,
SimpleDatabaseOidList *dbname_oid_list,
- ofile = fopen(out_file_path, PG_BINARY_W);
+ if (strcmp(outfile, "-") == 0){
+ int fn = fileno(stdout);
+ ofile = fdopen(dup(fn), PG_BINARY_W);
+ }
+ else{
+ snprintf(out_file_path, MAXPGPATH, "%s", outfile);
+ ofile = fopen(out_file_path, PG_BINARY_W);
+ }
+
if (ofile == NULL)
{
Regards,
Srinath Reddy Sadipiralla,
EDB: https://www.enterprisedb.com <http://www.enterprisedb.com/;
>
view thread (36+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Non-text mode for pg_dumpall
In-Reply-To: <CAFC+b6pWQiSL+3rvLxN9vhC8aONp4OV9c6u+BVD6kmWmDbd1WQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox