Thread: stupid patch of pg_dumplo

stupid patch of pg_dumplo

From
andrea gelmini
Date:
hi all,
     i would like to se this patch applied, because i often use
     pg_dumplo, and i need to set the port number of the server to contact.
     anyway, i don't have C language skill, so be careful with these
     lines... they work for me, but...

thanks for your time,
andrea gelmini

*** contrib/pg_dumplo/main.c    Thu Nov  8 13:36:14 2001
--- contrib/pg_dumplo/mio    Thu Nov  8 13:50:56 2001
***************
*** 31,39 ****

  extern int    errno;

! char       *progname = NULL;

! int            main(int argc, char **argv);
  static void usage(void);
  static void parse_lolist(LODumpMaster * pgLO);

--- 31,40 ----

  extern int    errno;

! char        *progname = NULL;
! char        *pgport   = NULL;

! int         main(int argc, char **argv);
  static void usage(void);
  static void parse_lolist(LODumpMaster * pgLO);

***************
*** 81,86 ****
--- 82,88 ----
              {"pwd", required_argument, 0, 'p'},
              {"db", required_argument, 0, 'd'},
              {"host", required_argument, 0, 'h'},
+             {"port", required_argument, 0, 'o'},
              {"space", required_argument, 0, 's'},
              {"import", no_argument, 0, 'i'},
              {"export", no_argument, 0, 'e'},
***************
*** 91,100 ****
              {NULL, 0, 0, 0}
          };

!         while ((arg = getopt_long(argc, argv, "?aehu:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
          {
  #else
!         while ((arg = getopt(argc, argv, "?aehu:p:qd:l:t:irs:w")) != -1)
          {
  #endif
              switch (arg)
--- 93,102 ----
              {NULL, 0, 0, 0}
          };

!         while ((arg = getopt_long(argc, argv, "?aehou:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
          {
  #else
!         while ((arg = getopt(argc, argv, "?aehou:p:qd:l:t:irs:w")) != -1)
          {
  #endif
              switch (arg)
***************
*** 118,123 ****
--- 120,128 ----
                  case 's':
                      pgLO->space = strdup(optarg);
                      break;
+                 case 'o':
+                     pgport = optarg;
+                     break;
                  case 'i':
                      pgLO->action = ACTION_IMPORT;
                      break;
***************
*** 173,179 ****
      /*
       * Make connection
       */
!     pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db,
                                pgLO->user, pwd);

      if (PQstatus(pgLO->conn) == CONNECTION_BAD)
--- 178,184 ----
      /*
       * Make connection
       */
!     pgLO->conn = PQsetdbLogin(pgLO->host, pgport, NULL, NULL, pgLO->db,
                                pgLO->user, pwd);

      if (PQstatus(pgLO->conn) == CONNECTION_BAD)
***************
*** 279,284 ****
--- 284,290 ----
         "-p --password=<password>     password for connection to server\n"
           "-d --db=<database>           database name\n"
           "-t --host=<hostname>         server hostname\n"
+          "-o --port=<port>             database server port (default: 5432)\n"
           "-s --space=<dir>             directory with dump tree (for export/import)\n"
           "-i --import                  import large obj dump tree to DB\n"
      "-e --export                  export (dump) large obj to dump tree\n"
***************
*** 295,300 ****
--- 301,307 ----
         "-p <password>                password for connection to server\n"
           "-d <database>                database name\n"
           "-t <hostname>                server hostname\n"
+          "-o <port>               database server port (default: 5432)\n"
           "-s <dir>                     directory with dump tree (for export/import)\n"
           "-i                           import large obj dump tree to DB\n"
      "-e                           export (dump) large obj to dump tree\n"

Re: stupid patch of pg_dumplo

From
Karel Zak
Date:
On Thu, Nov 08, 2001 at 01:52:47PM +0100, andrea gelmini wrote:
> hi all,
>      i would like to se this patch applied, because i often use
>      pg_dumplo, and i need to set the port number of the server to contact.

 It's good idea, maybe you can try add other values usable in
 PQsetdbLogin.

>      anyway, i don't have C language skill, so be careful with these
>      lines... they work for me, but...

 Please use other code in pg_dumplo/main.c as inspiration.

 If you want add "port" add it to pgLO struct (see pg_dumplo.h) and
 fill this value like others in this sources.

>                   case 's':
>                       pgLO->space = strdup(optarg);
>                       break;
> +                 case 'o':
> +                     pgport = optarg;
> +                     break;

 rather:
                   case 'o':
                        pgLO->port = strdup(optarg);
                        break;

> !     pgLO->conn = PQsetdbLogin(pgLO->host, pgport, NULL, NULL, pgLO->db,
>                                 pgLO->user, pwd);

 rather:

 pgLO->conn = PQsetdbLogin(pgLO->host, pgLO->port, NULL, NULL, pgLO->db,
                                pgLO->user, pwd);


 Please correct your patch and I mean will no problem add it to
 official code.

 Thanks

        Karel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

Re: stupid patch of pg_dumplo

From
andrea gelmini
Date:
On gio, nov 08, 2001 at 02:32:27 +0100, Karel Zak wrote:
>  It's good idea, maybe you can try add other values usable in
>  PQsetdbLogin.

yes, maybe in the future... now two problems: a) relation 'option' ->
'letter' is a little mess (but i don't see solution), b) i'm a son of shell
programming... and so... read the "how to lost one day on a stupid
problem" in the bottom...
also, now i don't figure out what other useful PQsetdbLogin values can be
good for this util (give me the light!)

>  Please use other code in pg_dumplo/main.c as inspiration.
it was my first try... but i failed...
so i tried with the ugly way (i've seen it also in other *.c file in contrib,
maybe i'll fix them)...
ehm... now i retry...

>  Please correct your patch and I mean will no problem add it to
>  official code.
ok, tell me if this is good.

thanks for your time,
andrea

-----
how to lost one day on a stupid problem

i try to change my fully functional patch in the way suggested...
but it core dumps...
thinking, thinking, thinking...
everything is same but the line:

pgLO->port = strdup(optarg);

makes a core dump...
gdb says 'that line is evil'...
and i go crazy...
ask to one friend,
ask to two friends...
nothing...
core dump...
core dump...
and...
the light...

getopt_long(argc, argv, "?aehou:p:qd:l:t:irs:w"

i put 'o' without ':'

argh!

-----

Common subdirectories: pg_dumplo.orig/CVS and pg_dumplo/CVS
diff -c pg_dumplo.orig/main.c pg_dumplo/main.c
*** pg_dumplo.orig/main.c    Thu Oct 25 16:23:33 2001
--- pg_dumplo/main.c    Mon Nov 12 16:25:56 2001
***************
*** 56,61 ****
--- 56,62 ----
      pgLO->user = NULL;
      pgLO->db = NULL;
      pgLO->host = NULL;
+     pgLO->port = NULL;
      pgLO->space = NULL;
      pgLO->index = NULL;
      pgLO->remove = FALSE;
***************
*** 81,86 ****
--- 82,88 ----
              {"pwd", required_argument, 0, 'p'},
              {"db", required_argument, 0, 'd'},
              {"host", required_argument, 0, 'h'},
+             {"port", required_argument, 0, 'o'},
              {"space", required_argument, 0, 's'},
              {"import", no_argument, 0, 'i'},
              {"export", no_argument, 0, 'e'},
***************
*** 91,100 ****
              {NULL, 0, 0, 0}
          };

!         while ((arg = getopt_long(argc, argv, "?aehu:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
          {
  #else
!         while ((arg = getopt(argc, argv, "?aehu:p:qd:l:t:irs:w")) != -1)
          {
  #endif
              switch (arg)
--- 93,102 ----
              {NULL, 0, 0, 0}
          };

!         while ((arg = getopt_long(argc, argv, "?aeho:u:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
          {
  #else
!         while ((arg = getopt(argc, argv, "?aeho:u:p:qd:l:t:irs:w")) != -1)
          {
  #endif
              switch (arg)
***************
*** 109,114 ****
--- 111,119 ----
                  case 't':
                      pgLO->host = strdup(optarg);
                      break;
+                 case 'o':
+                     pgLO->port = strdup(optarg);
+                     break;
                  case 'p':
                      pwd = strdup(optarg);
                      break;
***************
*** 173,179 ****
      /*
       * Make connection
       */
!     pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db,
                                pgLO->user, pwd);

      if (PQstatus(pgLO->conn) == CONNECTION_BAD)
--- 178,184 ----
      /*
       * Make connection
       */
!     pgLO->conn = PQsetdbLogin(pgLO->host, pgLO->port, NULL, NULL, pgLO->db,
                                pgLO->user, pwd);

      if (PQstatus(pgLO->conn) == CONNECTION_BAD)
***************
*** 279,284 ****
--- 284,290 ----
         "-p --password=<password>     password for connection to server\n"
           "-d --db=<database>           database name\n"
           "-t --host=<hostname>         server hostname\n"
+          "-o --port=<port>             database server port (default: 5432)\n"
           "-s --space=<dir>             directory with dump tree (for export/import)\n"
           "-i --import                  import large obj dump tree to DB\n"
      "-e --export                  export (dump) large obj to dump tree\n"
***************
*** 295,300 ****
--- 301,307 ----
         "-p <password>                password for connection to server\n"
           "-d <database>                database name\n"
           "-t <hostname>                server hostname\n"
+          "-o <port>                    database server port (default: 5432)\n"
           "-s <dir>                     directory with dump tree (for export/import)\n"
           "-i                           import large obj dump tree to DB\n"
      "-e                           export (dump) large obj to dump tree\n"
diff -c pg_dumplo.orig/pg_dumplo.h pg_dumplo/pg_dumplo.h
*** pg_dumplo.orig/pg_dumplo.h    Tue Nov  6 13:17:39 2001
--- pg_dumplo/pg_dumplo.h    Mon Nov 12 14:04:48 2001
***************
*** 51,56 ****
--- 51,57 ----
                 *user,
                 *db,
                 *host,
+                *port,
                 *space;
      FILE       *index;
      int            counter,

Re: stupid patch of pg_dumplo

From
Karel Zak
Date:
On Mon, Nov 12, 2001 at 10:46:37AM +0100, andrea gelmini wrote:
> >  Please correct your patch and I mean will no problem add it to
> >  official code.
> ok, tell me if this is good.

 It seems good now.

 I unsure if now is good time add it into 7.2 when we are in the beta
 time. But it's simple, short patch into contrib. Bruce?

            Karel

> how to lost one day on a stupid problem
>
> pgLO->port = strdup(optarg);

> and...
> the light...
>
> getopt_long(argc, argv, "?aehou:p:qd:l:t:irs:w"
>
> i put 'o' without ':'

 :-) One good thing: you are now better C programmer that know how
 works 'getopt' stuff.

> -----
>
> Common subdirectories: pg_dumplo.orig/CVS and pg_dumplo/CVS
> diff -c pg_dumplo.orig/main.c pg_dumplo/main.c
> *** pg_dumplo.orig/main.c    Thu Oct 25 16:23:33 2001
> --- pg_dumplo/main.c    Mon Nov 12 16:25:56 2001
> ***************
> *** 56,61 ****
> --- 56,62 ----
>       pgLO->user = NULL;
>       pgLO->db = NULL;
>       pgLO->host = NULL;
> +     pgLO->port = NULL;
>       pgLO->space = NULL;
>       pgLO->index = NULL;
>       pgLO->remove = FALSE;
> ***************
> *** 81,86 ****
> --- 82,88 ----
>               {"pwd", required_argument, 0, 'p'},
>               {"db", required_argument, 0, 'd'},
>               {"host", required_argument, 0, 'h'},
> +             {"port", required_argument, 0, 'o'},
>               {"space", required_argument, 0, 's'},
>               {"import", no_argument, 0, 'i'},
>               {"export", no_argument, 0, 'e'},
> ***************
> *** 91,100 ****
>               {NULL, 0, 0, 0}
>           };
>
> !         while ((arg = getopt_long(argc, argv, "?aehu:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
>           {
>   #else
> !         while ((arg = getopt(argc, argv, "?aehu:p:qd:l:t:irs:w")) != -1)
>           {
>   #endif
>               switch (arg)
> --- 93,102 ----
>               {NULL, 0, 0, 0}
>           };
>
> !         while ((arg = getopt_long(argc, argv, "?aeho:u:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
>           {
>   #else
> !         while ((arg = getopt(argc, argv, "?aeho:u:p:qd:l:t:irs:w")) != -1)
>           {
>   #endif
>               switch (arg)
> ***************
> *** 109,114 ****
> --- 111,119 ----
>                   case 't':
>                       pgLO->host = strdup(optarg);
>                       break;
> +                 case 'o':
> +                     pgLO->port = strdup(optarg);
> +                     break;
>                   case 'p':
>                       pwd = strdup(optarg);
>                       break;
> ***************
> *** 173,179 ****
>       /*
>        * Make connection
>        */
> !     pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db,
>                                 pgLO->user, pwd);
>
>       if (PQstatus(pgLO->conn) == CONNECTION_BAD)
> --- 178,184 ----
>       /*
>        * Make connection
>        */
> !     pgLO->conn = PQsetdbLogin(pgLO->host, pgLO->port, NULL, NULL, pgLO->db,
>                                 pgLO->user, pwd);
>
>       if (PQstatus(pgLO->conn) == CONNECTION_BAD)
> ***************
> *** 279,284 ****
> --- 284,290 ----
>          "-p --password=<password>     password for connection to server\n"
>            "-d --db=<database>           database name\n"
>            "-t --host=<hostname>         server hostname\n"
> +          "-o --port=<port>             database server port (default: 5432)\n"
>            "-s --space=<dir>             directory with dump tree (for export/import)\n"
>            "-i --import                  import large obj dump tree to DB\n"
>       "-e --export                  export (dump) large obj to dump tree\n"
> ***************
> *** 295,300 ****
> --- 301,307 ----
>          "-p <password>                password for connection to server\n"
>            "-d <database>                database name\n"
>            "-t <hostname>                server hostname\n"
> +          "-o <port>                    database server port (default: 5432)\n"
>            "-s <dir>                     directory with dump tree (for export/import)\n"
>            "-i                           import large obj dump tree to DB\n"
>       "-e                           export (dump) large obj to dump tree\n"
> diff -c pg_dumplo.orig/pg_dumplo.h pg_dumplo/pg_dumplo.h
> *** pg_dumplo.orig/pg_dumplo.h    Tue Nov  6 13:17:39 2001
> --- pg_dumplo/pg_dumplo.h    Mon Nov 12 14:04:48 2001
> ***************
> *** 51,56 ****
> --- 51,57 ----
>                  *user,
>                  *db,
>                  *host,
> +                *port,
>                  *space;
>       FILE       *index;
>       int            counter,
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

Re: stupid patch of pg_dumplo

From
Bruce Momjian
Date:
> On Mon, Nov 12, 2001 at 10:46:37AM +0100, andrea gelmini wrote:
> > >  Please correct your patch and I mean will no problem add it to
> > >  official code.
> > ok, tell me if this is good.
>
>  It seems good now.
>
>  I unsure if now is good time add it into 7.2 when we are in the beta
>  time. But it's simple, short patch into contrib. Bruce?

Tough call.  It is /contrib, which can get changes pretty late.  Let's
see if someone else has an opinion.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: stupid patch of pg_dumplo

From
Bruce Momjian
Date:
Patch applied.  Thanks.

---------------------------------------------------------------------------


> On gio, nov 08, 2001 at 02:32:27 +0100, Karel Zak wrote:
> >  It's good idea, maybe you can try add other values usable in
> >  PQsetdbLogin.
>
> yes, maybe in the future... now two problems: a) relation 'option' ->
> 'letter' is a little mess (but i don't see solution), b) i'm a son of shell
> programming... and so... read the "how to lost one day on a stupid
> problem" in the bottom...
> also, now i don't figure out what other useful PQsetdbLogin values can be
> good for this util (give me the light!)
>
> >  Please use other code in pg_dumplo/main.c as inspiration.
> it was my first try... but i failed...
> so i tried with the ugly way (i've seen it also in other *.c file in contrib,
> maybe i'll fix them)...
> ehm... now i retry...
>
> >  Please correct your patch and I mean will no problem add it to
> >  official code.
> ok, tell me if this is good.
>
> thanks for your time,
> andrea
>
> -----
> how to lost one day on a stupid problem
>
> i try to change my fully functional patch in the way suggested...
> but it core dumps...
> thinking, thinking, thinking...
> everything is same but the line:
>
> pgLO->port = strdup(optarg);
>
> makes a core dump...
> gdb says 'that line is evil'...
> and i go crazy...
> ask to one friend,
> ask to two friends...
> nothing...
> core dump...
> core dump...
> and...
> the light...
>
> getopt_long(argc, argv, "?aehou:p:qd:l:t:irs:w"
>
> i put 'o' without ':'
>
> argh!
>
> -----
>
> Common subdirectories: pg_dumplo.orig/CVS and pg_dumplo/CVS
> diff -c pg_dumplo.orig/main.c pg_dumplo/main.c
> *** pg_dumplo.orig/main.c    Thu Oct 25 16:23:33 2001
> --- pg_dumplo/main.c    Mon Nov 12 16:25:56 2001
> ***************
> *** 56,61 ****
> --- 56,62 ----
>       pgLO->user = NULL;
>       pgLO->db = NULL;
>       pgLO->host = NULL;
> +     pgLO->port = NULL;
>       pgLO->space = NULL;
>       pgLO->index = NULL;
>       pgLO->remove = FALSE;
> ***************
> *** 81,86 ****
> --- 82,88 ----
>               {"pwd", required_argument, 0, 'p'},
>               {"db", required_argument, 0, 'd'},
>               {"host", required_argument, 0, 'h'},
> +             {"port", required_argument, 0, 'o'},
>               {"space", required_argument, 0, 's'},
>               {"import", no_argument, 0, 'i'},
>               {"export", no_argument, 0, 'e'},
> ***************
> *** 91,100 ****
>               {NULL, 0, 0, 0}
>           };
>
> !         while ((arg = getopt_long(argc, argv, "?aehu:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
>           {
>   #else
> !         while ((arg = getopt(argc, argv, "?aehu:p:qd:l:t:irs:w")) != -1)
>           {
>   #endif
>               switch (arg)
> --- 93,102 ----
>               {NULL, 0, 0, 0}
>           };
>
> !         while ((arg = getopt_long(argc, argv, "?aeho:u:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
>           {
>   #else
> !         while ((arg = getopt(argc, argv, "?aeho:u:p:qd:l:t:irs:w")) != -1)
>           {
>   #endif
>               switch (arg)
> ***************
> *** 109,114 ****
> --- 111,119 ----
>                   case 't':
>                       pgLO->host = strdup(optarg);
>                       break;
> +                 case 'o':
> +                     pgLO->port = strdup(optarg);
> +                     break;
>                   case 'p':
>                       pwd = strdup(optarg);
>                       break;
> ***************
> *** 173,179 ****
>       /*
>        * Make connection
>        */
> !     pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db,
>                                 pgLO->user, pwd);
>
>       if (PQstatus(pgLO->conn) == CONNECTION_BAD)
> --- 178,184 ----
>       /*
>        * Make connection
>        */
> !     pgLO->conn = PQsetdbLogin(pgLO->host, pgLO->port, NULL, NULL, pgLO->db,
>                                 pgLO->user, pwd);
>
>       if (PQstatus(pgLO->conn) == CONNECTION_BAD)
> ***************
> *** 279,284 ****
> --- 284,290 ----
>          "-p --password=<password>     password for connection to server\n"
>            "-d --db=<database>           database name\n"
>            "-t --host=<hostname>         server hostname\n"
> +          "-o --port=<port>             database server port (default: 5432)\n"
>            "-s --space=<dir>             directory with dump tree (for export/import)\n"
>            "-i --import                  import large obj dump tree to DB\n"
>       "-e --export                  export (dump) large obj to dump tree\n"
> ***************
> *** 295,300 ****
> --- 301,307 ----
>          "-p <password>                password for connection to server\n"
>            "-d <database>                database name\n"
>            "-t <hostname>                server hostname\n"
> +          "-o <port>                    database server port (default: 5432)\n"
>            "-s <dir>                     directory with dump tree (for export/import)\n"
>            "-i                           import large obj dump tree to DB\n"
>       "-e                           export (dump) large obj to dump tree\n"
> diff -c pg_dumplo.orig/pg_dumplo.h pg_dumplo/pg_dumplo.h
> *** pg_dumplo.orig/pg_dumplo.h    Tue Nov  6 13:17:39 2001
> --- pg_dumplo/pg_dumplo.h    Mon Nov 12 14:04:48 2001
> ***************
> *** 51,56 ****
> --- 51,57 ----
>                  *user,
>                  *db,
>                  *host,
> +                *port,
>                  *space;
>       FILE       *index;
>       int            counter,
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: stupid patch of pg_dumplo

From
Bruce Momjian
Date:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tough call.  It is /contrib, which can get changes pretty late.  Let's
> > see if someone else has an opinion.
>
> Well, if I look at it with a gimlet eye then it looks like a new feature
> ;-) ... but considering that it's in contrib, I say let it pass.  The
> risk seems very low.

OK, that's two yes votes.  Patch applied to /contrib/pg_dumplo.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: stupid patch of pg_dumplo

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tough call.  It is /contrib, which can get changes pretty late.  Let's
> see if someone else has an opinion.

Well, if I look at it with a gimlet eye then it looks like a new feature
;-) ... but considering that it's in contrib, I say let it pass.  The
risk seems very low.

            regards, tom lane

Re: stupid patch of pg_dumplo

From
Peter Eisentraut
Date:
Bruce Momjian writes:

> > On Mon, Nov 12, 2001 at 10:46:37AM +0100, andrea gelmini wrote:
> > > >  Please correct your patch and I mean will no problem add it to
> > > >  official code.
> > > ok, tell me if this is good.
> >
> >  It seems good now.
> >
> >  I unsure if now is good time add it into 7.2 when we are in the beta
> >  time. But it's simple, short patch into contrib. Bruce?
>
> Tough call.  It is /contrib, which can get changes pretty late.  Let's
> see if someone else has an opinion.

I think pg_dumplo is mostly obsolete, no?

--
Peter Eisentraut   peter_e@gmx.net


Re: stupid patch of pg_dumplo

From
Bruce Momjian
Date:
> > Tough call.  It is /contrib, which can get changes pretty late.  Let's
> > see if someone else has an opinion.
>
> I think pg_dumplo is mostly obsolete, no?

I think it is there for older releases?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: stupid patch of pg_dumplo

From
Karel Zak
Date:
On Mon, Nov 12, 2001 at 02:19:27PM -0500, Bruce Momjian wrote:
> > > Tough call.  It is /contrib, which can get changes pretty late.  Let's
> > > see if someone else has an opinion.
> >
> > I think pg_dumplo is mostly obsolete, no?
>
> I think it is there for older releases?

 Yes, it's independent on PostgreSQL versions and pg_dump stuff.
 Maybe someone like pg_dumplo output format :-)

        Karel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

Re: stupid patch of pg_dumplo

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


andrea gelmini wrote:
> hi all,
>      i would like to se this patch applied, because i often use
>      pg_dumplo, and i need to set the port number of the server to contact.
>      anyway, i don't have C language skill, so be careful with these
>      lines... they work for me, but...
>
> thanks for your time,
> andrea gelmini
>
> *** contrib/pg_dumplo/main.c    Thu Nov  8 13:36:14 2001
> --- contrib/pg_dumplo/mio    Thu Nov  8 13:50:56 2001
> ***************
> *** 31,39 ****
>
>   extern int    errno;
>
> ! char       *progname = NULL;
>
> ! int            main(int argc, char **argv);
>   static void usage(void);
>   static void parse_lolist(LODumpMaster * pgLO);
>
> --- 31,40 ----
>
>   extern int    errno;
>
> ! char        *progname = NULL;
> ! char        *pgport   = NULL;
>
> ! int         main(int argc, char **argv);
>   static void usage(void);
>   static void parse_lolist(LODumpMaster * pgLO);
>
> ***************
> *** 81,86 ****
> --- 82,88 ----
>               {"pwd", required_argument, 0, 'p'},
>               {"db", required_argument, 0, 'd'},
>               {"host", required_argument, 0, 'h'},
> +             {"port", required_argument, 0, 'o'},
>               {"space", required_argument, 0, 's'},
>               {"import", no_argument, 0, 'i'},
>               {"export", no_argument, 0, 'e'},
> ***************
> *** 91,100 ****
>               {NULL, 0, 0, 0}
>           };
>
> !         while ((arg = getopt_long(argc, argv, "?aehu:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
>           {
>   #else
> !         while ((arg = getopt(argc, argv, "?aehu:p:qd:l:t:irs:w")) != -1)
>           {
>   #endif
>               switch (arg)
> --- 93,102 ----
>               {NULL, 0, 0, 0}
>           };
>
> !         while ((arg = getopt_long(argc, argv, "?aehou:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
>           {
>   #else
> !         while ((arg = getopt(argc, argv, "?aehou:p:qd:l:t:irs:w")) != -1)
>           {
>   #endif
>               switch (arg)
> ***************
> *** 118,123 ****
> --- 120,128 ----
>                   case 's':
>                       pgLO->space = strdup(optarg);
>                       break;
> +                 case 'o':
> +                     pgport = optarg;
> +                     break;
>                   case 'i':
>                       pgLO->action = ACTION_IMPORT;
>                       break;
> ***************
> *** 173,179 ****
>       /*
>        * Make connection
>        */
> !     pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db,
>                                 pgLO->user, pwd);
>
>       if (PQstatus(pgLO->conn) == CONNECTION_BAD)
> --- 178,184 ----
>       /*
>        * Make connection
>        */
> !     pgLO->conn = PQsetdbLogin(pgLO->host, pgport, NULL, NULL, pgLO->db,
>                                 pgLO->user, pwd);
>
>       if (PQstatus(pgLO->conn) == CONNECTION_BAD)
> ***************
> *** 279,284 ****
> --- 284,290 ----
>          "-p --password=<password>     password for connection to server\n"
>            "-d --db=<database>           database name\n"
>            "-t --host=<hostname>         server hostname\n"
> +          "-o --port=<port>             database server port (default: 5432)\n"
>            "-s --space=<dir>             directory with dump tree (for export/import)\n"
>            "-i --import                  import large obj dump tree to DB\n"
>       "-e --export                  export (dump) large obj to dump tree\n"
> ***************
> *** 295,300 ****
> --- 301,307 ----
>          "-p <password>                password for connection to server\n"
>            "-d <database>                database name\n"
>            "-t <hostname>                server hostname\n"
> +          "-o <port>               database server port (default: 5432)\n"
>            "-s <dir>                     directory with dump tree (for export/import)\n"
>            "-i                           import large obj dump tree to DB\n"
>       "-e                           export (dump) large obj to dump tree\n"
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: stupid patch of pg_dumplo

From
Bruce Momjian
Date:
Actually, I have to modify the patch to match these requested changes.
I will do it unless someone gets to it first.

---------------------------------------------------------------------------

Karel Zak wrote:
> On Thu, Nov 08, 2001 at 01:52:47PM +0100, andrea gelmini wrote:
> > hi all,
> >      i would like to se this patch applied, because i often use
> >      pg_dumplo, and i need to set the port number of the server to contact.
>
>  It's good idea, maybe you can try add other values usable in
>  PQsetdbLogin.
>
> >      anyway, i don't have C language skill, so be careful with these
> >      lines... they work for me, but...
>
>  Please use other code in pg_dumplo/main.c as inspiration.
>
>  If you want add "port" add it to pgLO struct (see pg_dumplo.h) and
>  fill this value like others in this sources.
>
> >                   case 's':
> >                       pgLO->space = strdup(optarg);
> >                       break;
> > +                 case 'o':
> > +                     pgport = optarg;
> > +                     break;
>
>  rather:
>                    case 'o':
>                         pgLO->port = strdup(optarg);
>                         break;
>
> > !     pgLO->conn = PQsetdbLogin(pgLO->host, pgport, NULL, NULL, pgLO->db,
> >                                 pgLO->user, pwd);
>
>  rather:
>
>  pgLO->conn = PQsetdbLogin(pgLO->host, pgLO->port, NULL, NULL, pgLO->db,
>                                 pgLO->user, pwd);
>
>
>  Please correct your patch and I mean will no problem add it to
>  official code.
>
>  Thanks
>
>         Karel
>
> --
>  Karel Zak  <zakkr@zf.jcu.cz>
>  http://home.zf.jcu.cz/~zakkr/
>
>  C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: stupid patch of pg_dumplo

From
Bruce Momjian
Date:
andrea gelmini wrote:
> On ven, feb 22, 2002 at 03:05:36 -0500, Bruce Momjian wrote:
> >
> > Your patch has been added to the PostgreSQL unapplied patches list at:
> >
> >     http://candle.pha.pa.us/cgi-bin/pgpatches
> >
> > I will try to apply it within the next 48 hours.
>
> I did not understand... this patch were already applied when i proposed it.

Oh, thanks.  Never mind.  I got confused.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: stupid patch of pg_dumplo

From
andrea gelmini
Date:
On ven, feb 22, 2002 at 03:05:36 -0500, Bruce Momjian wrote:
>
> Your patch has been added to the PostgreSQL unapplied patches list at:
>
>     http://candle.pha.pa.us/cgi-bin/pgpatches
>
> I will try to apply it within the next 48 hours.

I did not understand... this patch were already applied when i proposed it.

ciao,
andrea

Re: stupid patch of pg_dumplo

From
andrea gelmini
Date:
On ven, feb 22, 2002 at 03:06:46 -0500, Bruce Momjian wrote:
>
> Actually, I have to modify the patch to match these requested changes.
> I will do it unless someone gets to it first.

already done, already there.
i've checked yesterday (22) cvs tree, and everything is ok...

ciao,
andrea