Re: tiny patch to make vacuumdb -a's database order match pg_dumpall - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: tiny patch to make vacuumdb -a's database order match pg_dumpall
Date
Msg-id 200702131740.l1DHe4W25046@momjian.us
Whole thread Raw
In response to tiny patch to make vacuumdb -a's database order match pg_dumpall  ("Dan Thomas" <godders@gmail.com>)
List pgsql-patches
Dan Thomas wrote:
> Hiya,
>
> I've been having trouble running vacuumdb -a and pg_dumpall
> concurrently because they run through the databases in a different
> order (so dumpall was getting stuck behind vacuum's lock, and my
> firewall was rather unhelpfully closing the idle connection). I can't
> see a good reason for them to be using a different order, and as it
> will only affect those that have created new databases since restoring
> from a dump, may not be instantly obvious. It appears slightly more
> thought has gone into pg_dumpall's code (in that it actually includes
> an ORDER BY), so I elected to fiddle with vacuumdb.
>
> I hope this is in the correct format (this is the first patch I've
> submitted for anything), please let me know if I've done something
> daft.
>
> Dan
>
> 237c237
> <       result = executeQuery(conn, "SELECT datname FROM pg_database
> WHERE datallowconn;", progname, echo);
> ---
> >       result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;", progname,
echo);

OK, ORDER BY added for 8.3.

--
  Bruce Momjian  <bruce@momjian.us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/bin/scripts/vacuumdb.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/scripts/vacuumdb.c,v
retrieving revision 1.15
diff -c -c -r1.15 vacuumdb.c
*** src/bin/scripts/vacuumdb.c    5 Jan 2007 22:19:50 -0000    1.15
--- src/bin/scripts/vacuumdb.c    13 Feb 2007 17:37:09 -0000
***************
*** 234,240 ****
      int            i;

      conn = connectDatabase("postgres", host, port, username, password, progname);
!     result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn;", progname, echo);
      PQfinish(conn);

      for (i = 0; i < PQntuples(result); i++)
--- 234,240 ----
      int            i;

      conn = connectDatabase("postgres", host, port, username, password, progname);
!     result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;", progname, echo);
      PQfinish(conn);

      for (i = 0; i < PQntuples(result); i++)

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Have psql show current sequnce values - (Resubmission)
Next
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] contrib/levenshtein() has a bug?